mirror of https://github.com/ouqiang/gocron
50 lines
1.8 KiB
Plaintext
50 lines
1.8 KiB
Plaintext
|
go-logger <20><>golang <20><><EFBFBD><EFBFBD>־<EFBFBD><D6BE> <20><><EFBFBD><EFBFBD><EFBFBD>ڶ<EFBFBD>golang<6E><67><EFBFBD><EFBFBD>log<6F>ķ<EFBFBD>װ<EFBFBD><D7B0>
|
|||
|
<EFBFBD>÷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>java<EFBFBD><EFBFBD>־<EFBFBD><EFBFBD><EFBFBD>߰<EFBFBD>log4j
|
|||
|
|
|||
|
<EFBFBD><EFBFBD>ӡ<EFBFBD><EFBFBD>־<EFBFBD><EFBFBD>5<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Debug<75><67>Info<66><6F>Warn, Error ,Fatal <20><>־<EFBFBD><D6BE><EFBFBD><EFBFBD><EFBFBD>ɵ͵<C9B5><CDB5><EFBFBD>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>logger.SetLevel() <20>磺logger.SetLevel(logger.WARN)
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>logger.Debug(....),logger.Info(...) <20><>־<EFBFBD><D6BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
logger.Warn(...),logger.Error(...),logger.Fatal(...)<29><>־<EFBFBD><D6BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><EFBFBD><EFBFBD><EFBFBD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CEAA><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>С
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>С<EFBFBD>ĵ<EFBFBD>λ KB<4B><42>MB<4D><42>GB TB
|
|||
|
//logger.SetRollingFile("d:/logtest", "test.log", 10, 5, logger.KB)
|
|||
|
|
|||
|
//ָ<><D6B8><EFBFBD><EFBFBD>־<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ݷ<EFBFBD>ʽΪ<CABD><CEAA><EFBFBD>ڵķ<DAB5>ʽ
|
|||
|
//<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>־<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>Ŀ¼
|
|||
|
//<2F>ڶ<EFBFBD><DAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>־<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
logger.SetRollingDaily("d:/logtest", "test.log")
|
|||
|
|
|||
|
//ָ<><D6B8><EFBFBD><EFBFBD>־<EFBFBD><D6BE><EFBFBD><EFBFBD> ALL<4C><4C>DEBUG<55><47>INFO<46><4F>WARN<52><4E>ERROR<4F><52>FATAL<41><4C>OFF <20><><EFBFBD><EFBFBD><EFBFBD>ɵ͵<C9B5><CDB5><EFBFBD>
|
|||
|
//һ<><D2BB>ϰ<EFBFBD><CFB0><EFBFBD>Dz<EFBFBD><C7B2>Խ<D4BD>Ϊdebug<75><67><EFBFBD><EFBFBD><EFBFBD>ɻ<EFBFBD><C9BB><EFBFBD>Ϊinfo<66><6F><EFBFBD><EFBFBD>
|
|||
|
logger.SetLevel(logger.DEBUG)
|
|||
|
|
|||
|
|
|||
|
<EFBFBD><EFBFBD>ӡ<EFBFBD><EFBFBD>־<EFBFBD><EFBFBD>
|
|||
|
func log(i int) {
|
|||
|
logger.Debug("Debug>>>>>>>>>>>>>>>>>>>>>>" + strconv.Itoa(i))
|
|||
|
logger.Info("Info>>>>>>>>>>>>>>>>>>>>>>>>>" + strconv.Itoa(i))
|
|||
|
logger.Warn("Warn>>>>>>>>>>>>>>>>>>>>>>>>>" + strconv.Itoa(i))
|
|||
|
logger.Error("Error>>>>>>>>>>>>>>>>>>>>>>>>>" + strconv.Itoa(i))
|
|||
|
logger.Fatal("Fatal>>>>>>>>>>>>>>>>>>>>>>>>>" + strconv.Itoa(i))
|
|||
|
}
|