Documentation ¶
Overview ¶
Generic logger package
There are 3 loglevels for every Log. The user level is what should go into every log. These are log messages that normally appear in the logs. The verbose level should be used during development or when there is a problem with the service. The trace level is for debugging.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Log ¶
type Log struct { Level LogLevel // contains filtered or unexported fields }
Log is the mail log structure. This should be used to do multi-level logging.
func DefaultLogger ¶
DefaultLogger creates a Log with the recommended settings that writes to w.
func DefaultOSLogger ¶
func DefaultOSLogger() *Log
DefaultOSLogger creates a Log with the recommended settings that writes to stdout.
type LogLevel ¶
type LogLevel int8
const ( // User level log contains the most crucial information that should be logged. LOG_USER LogLevel = iota // Verbose level log contains information that help ops to troubleshoot issues. LOG_VERBOSE // Trace level log contains information that help developers to debug the service. LOG_TRACE LOG_OFF = -1 )
type Logger ¶
type Logger interface { Print(v ...interface{}) Printf(format string, v ...interface{}) Println(v ...interface{}) }
Logger is an interface for something that logs. This is used as a wrapper over log.Log.
func TraceLogFactory ¶
TraceLogFactory creates a trace level logger with the default settings.
func UserLogFactory ¶
UserLogFactory creates a user level logger with the default settings.
func VerboseLogFactory ¶
VerboseLogFactory creates a verbose level logger with the default settings.