Discover Packages
github.com/LeKovr/go-base
logger
package
Version:
v1.0.1
Opens a new window with list of versions in this module.
Published: Jan 11, 2021
License: MIT
Opens a new window with license information.
Imports: 3
Opens a new window with list of imports.
Imported by: 13
Opens a new window with list of known importers.
README
README
¶
Golang logger package
This is a proxy for github.com/Sirupsen/logrus with some additions like functional options and logging to file.
Expand ▾
Collapse ▴
Documentation
¶
Package logger incapsulates logger logic
This is a proxy for github.com/Sirupsen/logrus
with some additions like
functional options and logging to file
Dest sets log destionation (STDERR if empty and file if given)
Disable turns logging off
Level sets log level from a string value (debug/info/warn/error/fatal/panic)
TimeStamp adds timestamp in log output
type Fields map[string ]interface{}
Fields type, used to pass to `WithFields`.
type Flags struct {
Dest string `long:"log_dest" description:"Log destination (STDERR)"`
Level string `long:"log_level" description:"Log level [warn|info|debug]" default:"warn"`
}
Flags is a package flags sample
in form ready for use with github.com/jessevdk/go-flags
Log is a copy of logrus.Entry plus, when logging to file used, its filehandle.
New creates a logger object
Configuration should be set via functional options
Close closes filehandle if it was used
func (logger *Log ) WithField(key string , value interface{}) *Log
WithField add a var/value pair into logger output
WithFields adds a map into logger output
Source Files
¶
Click to show internal directories.
Click to hide internal directories.