logging

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2023 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseLogLevel

func ParseLogLevel(logLevel string) (log.Level, error)

ParseLogLevel returns the hclog.Level that corresponds with the provided level string. This differs hclog.LevelFromString in that it supports additional level strings.

func Setup

func Setup(config *LogConfig, w io.Writer) (log.InterceptLogger, error)

Setup creates a new logger with the specified configuration and writer

func TranslateLoggerLevel

func TranslateLoggerLevel(logger log.Logger) (string, error)

TranslateLoggerLevel returns the string that corresponds with logging level of the hclog.Logger.

Types

type LogConfig

type LogConfig struct {
	// Name is the name the returned logger will use to prefix log lines.
	Name string

	// LogLevel is the minimum level to be logged.
	LogLevel log.Level

	// LogFormat is the log format to use, supported formats are 'standard' and 'json'.
	LogFormat LogFormat

	// LogFilePath is the path to write the logs to the user specified file.
	LogFilePath string

	// LogRotateDuration is the user specified time to rotate logs
	LogRotateDuration time.Duration

	// LogRotateBytes is the user specified byte limit to rotate logs
	LogRotateBytes int

	// LogRotateMaxFiles is the maximum number of past archived log files to keep
	LogRotateMaxFiles int
}

LogConfig should be used to supply configuration when creating a new Vault logger

type LogFile

type LogFile struct {
	// contains filtered or unexported fields
}

func (*LogFile) Write

func (l *LogFile) Write(b []byte) (n int, err error)

Write is used to implement io.Writer

type LogFormat

type LogFormat int
const (
	UnspecifiedFormat LogFormat = iota
	StandardFormat
	JSONFormat
)

func ParseLogFormat

func ParseLogFormat(format string) (LogFormat, error)

ParseLogFormat parses the log format from the provided string.

func (LogFormat) String

func (lf LogFormat) String() string

Stringer implementation

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL