Documentation ¶
Overview ¶
go:build !windows
Index ¶
- func GetSyslog(protocol, conn, tag string) (io.Writer, error)
- func NewLogger(app, version string, opts ...Option) (*logger, error)
- type Logger
- type Option
- func WithEncoding(ec string) Option
- func WithInstanceID(instanceID string) Option
- func WithLogFile(filePath string) Option
- func WithLogLevel(level string) Option
- func WithOutput(w io.Writer) Option
- func WithRotationCount(count int) Option
- func WithRotationSize(size int) Option
- func WithSyslog(conn, protocol string) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Logger ¶
type Logger interface { Debug(msg string, keyvals ...interface{}) Info(msg string, keyvals ...interface{}) Warn(msg string, keyvals ...interface{}) Error(msg string, keyvals ...interface{}) Panic(msg string, keyvals ...interface{}) Fatal(msg string, keyvals ...interface{}) Printf(format string, args ...interface{}) Debugf(format string, args ...interface{}) With(keyvals ...interface{}) Logger // Set log level SetLogLevel(level string) // Set log rotation size SetLogRotationSize(size int) // Set log rotation count SetLogRotationCount(count int) }
A common logger interface to be used throughout platfrom components
type Option ¶
type Option func(*logger)
An Option configures a logger.
func WithInstanceID ¶
WithrotationCount overrides default log rotation file count
func WithLogFile ¶
WithLogFile overrides default log file path
func WithLogLevel ¶
WithLogLevel overrides the default log level
func WithOutput ¶
WithOutput configures the logger to write to stdout also
func WithRotationCount ¶
WithrotationCount overrides default log rotation file count
func WithRotationSize ¶
WithrotationSize overrides default log rotation file size
func WithSyslog ¶
WithSyslog configures the syslog server for log forwarding
Click to show internal directories.
Click to hide internal directories.