Documentation ¶
Index ¶
- type ChannelLogger
- func (cl *ChannelLogger) Close() error
- func (cl *ChannelLogger) Debug(message string)
- func (cl *ChannelLogger) Error(message string, errs ...error)
- func (cl *ChannelLogger) Info(message string)
- func (cl *ChannelLogger) Trace(message string)
- func (cl *ChannelLogger) Warn(message string, errs ...error)
- type ConsoleLogger
- func (cl *ConsoleLogger) Close() error
- func (cl *ConsoleLogger) Debug(message string)
- func (cl *ConsoleLogger) Error(message string, errs ...error)
- func (cl *ConsoleLogger) Info(message string)
- func (cl *ConsoleLogger) Trace(message string)
- func (cl *ConsoleLogger) Warn(message string, errs ...error)
- type Logger
- type NoOpsLogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChannelLogger ¶
type ChannelLogger struct {
// contains filtered or unexported fields
}
ChannelLogger is a logger that writes to a channel. Please, make sure that you read from the channel, otherwise it will block the pipeline execution.
ChannelLogger is handy when you want to write logs to a file or do some heavy actions on them, but don't want to affect performance of the pipeline.
ChannelLogger accepts a log level as a parameter. It will print only those logs that have a level equal or higher than the specified one. Check loglevels.LogLevel for more details.
Make sure to call the ChannelLogger.Close() method when you are done with the logger - this will close the channel.
func (*ChannelLogger) Close ¶
func (cl *ChannelLogger) Close() error
func (*ChannelLogger) Debug ¶
func (cl *ChannelLogger) Debug(message string)
func (*ChannelLogger) Error ¶
func (cl *ChannelLogger) Error(message string, errs ...error)
func (*ChannelLogger) Info ¶
func (cl *ChannelLogger) Info(message string)
func (*ChannelLogger) Trace ¶
func (cl *ChannelLogger) Trace(message string)
func (*ChannelLogger) Warn ¶
func (cl *ChannelLogger) Warn(message string, errs ...error)
type ConsoleLogger ¶
type ConsoleLogger struct {
// contains filtered or unexported fields
}
ConsoleLogger is a logger that prints logs to console. Basically, it uses fmt.Println() to print logs under the hood.
ConsoleLogger accepts a log level as a parameter. It will print only those logs that have a level equal or higher than the specified one. Check loglevels.LogLevel for more details.
The format of logs is: "time [log level] message" Example: 2006-01-02 15:04:05:000 [INFO] some cool info message
func (*ConsoleLogger) Close ¶
func (cl *ConsoleLogger) Close() error
func (*ConsoleLogger) Debug ¶
func (cl *ConsoleLogger) Debug(message string)
func (*ConsoleLogger) Error ¶
func (cl *ConsoleLogger) Error(message string, errs ...error)
func (*ConsoleLogger) Info ¶
func (cl *ConsoleLogger) Info(message string)
func (*ConsoleLogger) Trace ¶
func (cl *ConsoleLogger) Trace(message string)
func (*ConsoleLogger) Warn ¶
func (cl *ConsoleLogger) Warn(message string, errs ...error)
type Logger ¶
type Logger interface { Trace(message string) Debug(message string) Info(message string) Warn(message string, errs ...error) Error(message string, errs ...error) Close() error }
func NewConsoleLogger ¶
func NewNoOpsLogger ¶
func NewNoOpsLogger() Logger
type NoOpsLogger ¶
type NoOpsLogger struct{}
NoOpsLogger is a logger that does nothing. This is a default logger for the service if no logger is configured.
func (*NoOpsLogger) Close ¶
func (nol *NoOpsLogger) Close() error
func (*NoOpsLogger) Debug ¶
func (nol *NoOpsLogger) Debug(message string)
func (*NoOpsLogger) Error ¶
func (nol *NoOpsLogger) Error(message string, errs ...error)
func (*NoOpsLogger) Info ¶
func (nol *NoOpsLogger) Info(message string)
func (*NoOpsLogger) Trace ¶
func (nol *NoOpsLogger) Trace(message string)
func (*NoOpsLogger) Warn ¶
func (nol *NoOpsLogger) Warn(message string, errs ...error)