logger

module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 27, 2021 License: MIT

README

Пакет логгера

LogLevels

  • Debug() LogLevelDbg
  • Info() LogLevelInfo
  • Notify() LogLevelNotify
  • Warning() LogLevelWarning
  • Error() LogLevelError
  • Fatal() LogLevelFatal
  • Event() LogLevelEvent
  • Request() LogLevelRequest

Использование

import "gitlab.com/leolab/go/logger"

var log Logger

func main(){
    logCfg:=&LoggerConfig{
        DataStore : "sqlite>log",
            //:"mysql>user:pass@tcp(127.0.0.1:3306)/dbname?
            //:"postrges>host=localhost user=gorm password=gorm port=9920 sslmode=disable TimeZone=Asia/Ekaterinburg"
        LoggerPath : "log/log_file",
    }
    log,err:=NewLogger(&LoggerConfig{});
    if err!=nil{
        panic(err)
    }
    log.Debug("Debug level")
    log.Notify("Notify level)
    log.Info("Information level")
    log.Warning("Warning level")
    log.Error("Error level")
    log.Crit("Critical level")

    evt:=map[string]interface{}{
        "Source":"main",
        "Data":map[string]interface{}{
            "Data1":"Some data,
        }
    }

    log.Event("Event record",evt)

    req:=map[string]interface{}{}
    log.Request("Request record",req)

}

Методы

  • NewLogger(*LoggerConfig{}) (*Logger, error)
  • Logger{}
    • Debug(string, ...interface{})
    • Notify(string, ...interface{})
    • Info(string, ...interface{})
    • Warn(string, ...interface{})
    • Error(string, ...interface{})
    • Crit(string, ...interface{})
NewLogger()
Logger.Debug()
Logger.Notify()
Logger.Info()
Logger.Warn()
Logger.Error()
Logger.Crit()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL