Documentation ¶
Overview ¶
Copyright (c) 2020 Higker Open Source: MIT License Author: higker <deen.job@qq.com>
Index ¶
Constants ¶
View Source
const ( // Log file size // You can also customize. Unit is kb. MB10 int64 = 10 * 1024 * 1024 MB100 int64 = 100 * 1024 * 1024 GB1 int64 = 10 * MB100 )
View Source
const (
//[INFO] 2006-01-02 13:05.0006 MP - Position: test.go|main.test:21 - Message: news
FORMAT = "[%s] - Date: %s - Position: %s - Message: %s"
)
View Source
const (
SKIP = 3
)
Runtime caller skip
Variables ¶
This section is empty.
Functions ¶
func BuildCallerStr ¶
Types ¶
type FileLog ¶
type LogTimeZone ¶
type LogTimeZone string
const ( //https://blog.imdst.com/guo-bf/ //美东 EST /usr/share/zoneinfo/EST5EDT //美西 PST /usr/share/zoneinfo/PST8PDT //澳洲 CST /usr/share/zoneinfo/CST6CDT //欧洲 GMT /usr/share/zoneinfo/Europe/London //泰国 Thailand /usr/share/zoneinfo/Asia/Bangkok //越南 Vietnam /usr/share/zoneinfo/Asia/Ho_Chi_Minh //新加坡 Singapore /usr/share/zoneinfo/Asia/Singapore //台湾 Taiwan /usr/share/zoneinfo/Asia/Taipei //香港 HongKong /usr/share/zoneinfo/Asia/Hong_Kong //日本 Japan /usr/share/zoneinfo/Asia/Tokyo //韩国 Korea /usr/share/zoneinfo/Asia/Pyongyang EST LogTimeZone = "EST5EDT" PST LogTimeZone = "PST8PDT" CST LogTimeZone = "CST6CDT" GMT LogTimeZone = "Europe/London" Thailand LogTimeZone = "Asia/Bangkok" Vietnam LogTimeZone = "Asia/Ho_Chi_Minh" Singapore LogTimeZone = "Asia/Singapore" Taiwan LogTimeZone = "Asia/Taipei" HongKong LogTimeZone = "Asia/Hong_Kong" Japan LogTimeZone = "Asia/Tokyo" Korea LogTimeZone = "Asia/Pyongyang" China = "Asia/Shanghai" // Shanghai China )
type Logger ¶
type Logger interface { // English: Info level log Info(value string, arg ...interface{}) // Debug level log Debug(value string, arg ...interface{}) // Error level log Error(value string, arg ...interface{}) // Warning level log Warning(value string, arg ...interface{}) }
Logger interface. Abstract Logger object.
func NewClog ¶
func NewClog(level Level, zone LogTimeZone) Logger
Build console Logger Level: logger Level Zone : logger Time Zone
type TimeZone ¶
type TimeZone struct {
TimeZoneStr LogTimeZone // your custom time zone,recommend use this.
}
自定义时间类型 :customize time zone type struct
func (*TimeZone) NowTimeStr ¶
get time str fmt: 2006-01-02 15:04:05.0000 PM
Click to show internal directories.
Click to hide internal directories.