Documentation ¶
Index ¶
- func Debug(format string, a ...interface{})
- func Err(format string, a ...interface{}) error
- func Error(format string, a ...interface{})
- func Info(format string, a ...interface{})
- func IsTraceEnabled() bool
- func LevelToStr(level Level) string
- func LoadLogProperties()
- func Panic(format string, a ...interface{})
- func PrintLog(logLevel Level, format string, a []interface{})
- func SetTrace(trace bool)
- func SetWriters(w []Writer)
- func Warn(format string, a ...interface{})
- type FileSize
- type Level
- type Writer
- type WriterStdout
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsTraceEnabled ¶
func IsTraceEnabled() bool
IsTraceEnabled whether printing of file names and line numbers is enabled
func LoadLogProperties ¶
func LoadLogProperties()
LoadLogProperties loads properties from configuration file in LOG_CONFIG
func PrintLog ¶
PrintLog sends a log message to the writers. name: logger name loggerLevel: the level of the logger implementation logLevel: the level of the message. If the level of the message is greater than loggerLevel the log will bi discarted format: log format. See fmt.Printf a...: arguments. See fmt.Printf
Types ¶
type FileSize ¶
type FileSize int64
FileSize represents the size of a file
const ( // Kilobyte usage (Kilobyte * 2) = 2Kb Kilobyte FileSize = 1 << (10 * iota) // 1 << (10*1) // Megabyte usage (Megabyte * 2) = 2Mb Megabyte // 1 << (10*2) // Gigabyte usage (Gigabyte * 2) = 2Gb Gigabyte // 1 << (10*3) // Terabyte usage (Terabyte * 2) = 2Tb Terabyte // 1 << (10*4) // Petabyte usage (Petabyte * 2) = 2Pb Petabyte // 1 << (10*5) // Exabyte usage (Exabyte * 2) = 2Pb Exabyte // 1 << (10*6) )
type Level ¶
type Level int
Level Logging Level
func (*Level) MarshalJSON ¶
MarshalJSON json serializer
func (*Level) UnmarshalJSON ¶
UnmarshalJSON json unserializer
type Writer ¶
type Writer interface { WriteLog(logLevel Level, format string, args []interface{}) SetLevel(level Level) }
Writer writer interface
func GetDefaultWriter ¶ added in v1.0.6
func GetDefaultWriter() Writer
GetDefaultWriter gets the default writer
func NewFileWriter ¶
NewFileWriter retuns a new instance of fileWriter. Parameter logdir is the directory where logs will be written. Parameter fileName is the name to use when creating the files. Param maxSize is the maximum size of a log, when the size is exceded, the log is rotated. maxNumFiles is the maximum number of logs to keep.
func NewStdoutWriter ¶ added in v1.0.4
NewStdoutWriter constructor
type WriterStdout ¶
type WriterStdout struct {
// contains filtered or unexported fields
}
WriterStdout writes to the standard output
func (*WriterStdout) SetLevel ¶
func (w *WriterStdout) SetLevel(level Level)
SetLevel sets the writer level
func (*WriterStdout) WriteLog ¶
func (w *WriterStdout) WriteLog( messageLevel Level, format string, args []interface{}, )
WriteLog implementation of logger.Writer