Documentation ¶
Index ¶
Constants ¶
View Source
const ChanBuffSize = 10
ChanBuffSize defines the size of channel buffers
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct { Message string `json:"message"` Component string `json:"component"` Time time.Time `json:"time"` Level VerbosityLevel `json:"level"` }
Event contains log message and metadata
func NewEvent ¶
func NewEvent(msg string, component string, logLevel VerbosityLevel) Event
NewEvent creates an event
func (Event) EventString ¶
func (e Event) EventString() (string, VerbosityLevel)
EventString return a formatted string and the VerbosityLevel
type LevelType ¶
type LevelType struct { Name string Level VerbosityLevel }
LevelType defines level types
func GetDefaultLevelTypes ¶
func GetDefaultLevelTypes() []LevelType
GetDefaultLevelTypes returns default level type schema
func RetrieveLevel ¶
func RetrieveLevel(levelType []LevelType, level VerbosityLevel) LevelType
RetrieveLevel return the LevelType that matches VerbosityLevel
type Logger ¶
type Logger struct { In chan Event // RotationLen defines how many log entries to keep in memory/log to file RotationLen int // RetainLogs should be set to true to save logs to a file RetainLogs bool LogPrefix string LogFileDir string LogFilePerm os.FileMode // contains filtered or unexported fields }
Logger should be initialized if created manually and Handle() method should be called to start logging
func (*Logger) NewEvent ¶
NewEvent pushes a new event into the channel In
func (*Logger) SetLevels ¶
SetLevels sets internal levels to new - user provided levels
Click to show internal directories.
Click to hide internal directories.