Directories
¶
Path | Synopsis |
---|---|
Usage: import "github.com/baidu/go-lib/log" // Two log files will be generated in ./log: // test.log, and test.wf.log(for log > warn) // The log will rotate, and there is support for backup count log.Init("test", "INFO", "./log", true, "midnight", 5) log.Logger.Warn("warn msg") log.Logger.Info("info msg") // it is required, to work around bug of log4go time.Sleep(100 * time.Millisecond)
|
Usage: import "github.com/baidu/go-lib/log" // Two log files will be generated in ./log: // test.log, and test.wf.log(for log > warn) // The log will rotate, and there is support for backup count log.Init("test", "INFO", "./log", true, "midnight", 5) log.Logger.Warn("warn msg") log.Logger.Info("info msg") // it is required, to work around bug of log4go time.Sleep(100 * time.Millisecond) |
log4go
Package log4go provides level-based and highly configurable logging.
|
Package log4go provides level-based and highly configurable logging. |
time
|
|
timefmt
Usage: import "icode.baidu.com/go-lib/time/timefmt" println(timefmt.CurrTimeGet()) // 2006-01-02 15:04:05
|
Usage: import "icode.baidu.com/go-lib/time/timefmt" println(timefmt.CurrTimeGet()) // 2006-01-02 15:04:05 |
web-monitor
|
|
metrics
Usage: import "github.com/baidu/go-lib/web-monitor/metrics" // define counter struct type type ServerState { ReqServed *Counter // field type must be *Counter or *Gauge or *State ConServed *Counter ConActive *Gauge } // create metrics var m Metrics var s ServerState m.Init(&s, "PROXY", 20) // counter operations s.ConActive.Inc(2) s.ConServed.Inc(1) s.ReqServed.Inc(1) s.ConActive.Dec(1) m.Counter("CounterName").Inc(1) m.Gauge("GaugeName").Inc(1) m.State("StateName").Set("StateValue") // get absoulute data for all metrics stateData := m.GetAll() // get diff data for all counters(gauge don't have diff data) stateDiff := m.GetDiff()
|
Usage: import "github.com/baidu/go-lib/web-monitor/metrics" // define counter struct type type ServerState { ReqServed *Counter // field type must be *Counter or *Gauge or *State ConServed *Counter ConActive *Gauge } // create metrics var m Metrics var s ServerState m.Init(&s, "PROXY", 20) // counter operations s.ConActive.Inc(2) s.ConServed.Inc(1) s.ReqServed.Inc(1) s.ConActive.Dec(1) m.Counter("CounterName").Inc(1) m.Gauge("GaugeName").Inc(1) m.State("StateName").Set("StateValue") // get absoulute data for all metrics stateData := m.GetAll() // get diff data for all counters(gauge don't have diff data) stateDiff := m.GetDiff() |
Click to show internal directories.
Click to hide internal directories.