Categorygithub.com/hzxgo/log
modulepackage
1.0.0
Repository: https://github.com/hzxgo/log.git
Documentation: pkg.go.dev

# README

log

the log plug-in is base on logrus

Usage

  • basic usage

    import (
        "github.com/hzxgo/log"
    )
    
    func main() {
        var username string
        username = "HeZhiXiong"
    
        log.Debugf("this is debug log | %s", username)
        log.Infof("this is info log | %s", username)
        log.Warnf("this is warn log | %s", username)
        log.Errorf("this is error log | %s", username)
        log.Fatalf("this is fatal log | %s", username)
        log.Panicf("this is panic log | %s", username)
    }
    
  • init log by self

    import (
        "github.com/hzxgo/log"
    )
    
    func init() {
        logPath := "/data/logs/your_app_name/default.lgo"
        log.Init(true, 3, logPath) // it will write log to 'logPath' and delete three days ago logs
    }
    
    func main() {
        var username string
        username = "HeZhiXiong"
    
        log.Debugf("this is debug log | %s", username)
        log.Infof("this is info log | %s", username)
        log.Warnf("this is warn log | %s", username)
        log.Errorf("this is error log | %s", username)
        log.Fatalf("this is fatal log | %s", username)
        log.Panicf("this is panic log | %s", username)
    }
    
  • set log level you also can set log level by yourself like this log.SetLevel(log.INFO_LEVEL)

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Constants

No description provided by the author
默认 log 文件名称.
默认 log 保留最大天数.
默认 log 路径.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author