Documentation ¶
Index ¶
- Constants
- Variables
- func Btoi(s string) (uint64, error)
- func Debug(content interface{}, args ...interface{})
- func Error(content interface{}, args ...interface{})
- func Fatal(content string, args ...interface{})
- func Info(content interface{}, args ...interface{})
- func IsDebugEnable() bool
- func IsErrorEnable() bool
- func IsInfoEnable() bool
- func IsWarnEnable() bool
- func Itob(b uint64) string
- func LoadFromFile(configFile string) error
- func Registry(configFile string)
- func RegistryFromConfig(tag string, config *Config)
- func RegistryLoggerImplement(name string, factory LoggerFactory)
- func Warn(content interface{}, args ...interface{})
- type Appender
- type Config
- type ConsoleWriter
- type DefaultLogRecord
- type DefaultLogger
- func (logger *DefaultLogger) Close()
- func (logger *DefaultLogger) Debug(content interface{}, args ...interface{})
- func (logger *DefaultLogger) Error(content interface{}, args ...interface{})
- func (logger *DefaultLogger) Fatal(content interface{}, args ...interface{})
- func (logger *DefaultLogger) Info(content interface{}, args ...interface{})
- func (logger *DefaultLogger) IsDebugEnable() bool
- func (logger *DefaultLogger) IsErrorEnable() bool
- func (logger *DefaultLogger) IsInfoEnable() bool
- func (logger *DefaultLogger) IsWarnEnable() bool
- func (logger *DefaultLogger) Log(content interface{}, args ...interface{})
- func (logger *DefaultLogger) Warn(content interface{}, args ...interface{})
- type FileLogWriter
- type HTTPLogWriter
- type JLogger
- func (l *JLogger) Close()
- func (l *JLogger) Debug(content interface{}, args ...interface{})
- func (l *JLogger) Error(content interface{}, args ...interface{})
- func (l *JLogger) Fatal(content interface{}, args ...interface{})
- func (l *JLogger) Info(content interface{}, args ...interface{})
- func (l *JLogger) IsDebugEnable() bool
- func (l *JLogger) IsErrorEnable() bool
- func (l *JLogger) IsInfoEnable() bool
- func (l *JLogger) IsWarnEnable() bool
- func (l *JLogger) Log(content interface{}, args ...interface{})
- func (l *JLogger) Warn(content interface{}, args ...interface{})
- type Level
- type Log
- func (l *Log) Close()
- func (l *Log) Debug(content interface{}, args ...interface{})
- func (l *Log) Error(content interface{}, args ...interface{})
- func (l *Log) Fatal(content interface{}, args ...interface{})
- func (l *Log) Info(content interface{}, args ...interface{})
- func (l *Log) IsDebugEnable() bool
- func (l *Log) IsErrorEnable() bool
- func (l *Log) IsInfoEnable() bool
- func (l *Log) IsWarnEnable() bool
- func (l *Log) Log(content interface{}, args ...interface{})
- func (l *Log) Warn(content interface{}, args ...interface{})
- type LogRecord
- type LogWriter
- type Logger
- type LoggerFactory
- type SyncAppender
Constants ¶
View Source
const ( Byte = 1.0 Kilobyte = 1024 * Byte Megabyte = 1024 * Kilobyte Gigabyte = 1024 * Megabyte Terabyte = 1024 * Gigabyte )
View Source
const ( Prefix = "logging_" Writers = "writers" URL = "url" CallerLevelSkip = "caller_level_skip" LogLevel = "log_level" LogFile = "log_file" MaxSize = "max_size" Format = "format" Daily = "daily" ExpireDays = "expire_days" Compress = "compress" Separator = "_" )
View Source
const ( DebugFlag = false DefaultFile = "" DefaultWriter = "CONSOLE" DefaultURL = "http://127.0.0.1:8000" DefaultLevel = "INFO" DefaultFormat = "LONG" DefaultMaxSize = 104857600 DefaultDaily = true DefaultExpireDays = uint(30) DefaultCompress = true )
View Source
const ( LogFormat = "%s - %s(%s) -- %s" InvokeRecursiveLevel = 3 )
View Source
const ( DateFormatDay = "2006-01-02" OneDay = 24 * time.Hour )
View Source
const ( SizeRotate = iota DailyRotate )
View Source
const ( HTTPPost = "POST" UserAgent = "User-Agent" ContentType = "Content-Type" ContentTypeValue = "application/x-www-form-urlencoded; param=value" )
View Source
const ( LongLogFormat = "%s %s [%s] - %s\n" ShortLogFormat = "%s %s - %s\n" PlainLogFormat = "%s %s\n" DateFormat = "2006-01-02 15:04:05.000" FileWriterTag = "FILE" ConsoleWriterTag = "CONSOLE" HTTPWriterTag = "HTTP" )
View Source
const ( FATAL = iota ERROR WARN INFO DEBUG )
View Source
const (
ROOT = "root"
)
Variables ¶
View Source
var (
RootLogger = newRootLogger()
)
Functions ¶
func IsDebugEnable ¶
func IsDebugEnable() bool
func IsErrorEnable ¶
func IsErrorEnable() bool
func IsInfoEnable ¶
func IsInfoEnable() bool
func IsWarnEnable ¶
func IsWarnEnable() bool
func Itob ¶
ByteSize returns a human readable byte string, of the format 10M, 12.5K, etc. The following units are available:
T Terabyte G Gigabyte M Megabyte K Kilobyte
the unit that would result in printing the smallest whole number is always chosen
func LoadFromFile ¶
func RegistryFromConfig ¶
func RegistryLoggerImplement ¶
func RegistryLoggerImplement(name string, factory LoggerFactory)
Types ¶
type ConsoleWriter ¶
type ConsoleWriter struct {
// contains filtered or unexported fields
}
func (*ConsoleWriter) Close ¶
func (w *ConsoleWriter) Close()
func (*ConsoleWriter) GetCallerLevelSkip ¶
func (w *ConsoleWriter) GetCallerLevelSkip() uint
func (*ConsoleWriter) Log ¶
func (w *ConsoleWriter) Log(r LogRecord)
func (*ConsoleWriter) Open ¶
func (w *ConsoleWriter) Open() error
type DefaultLogRecord ¶
type DefaultLogRecord struct { Level Level RecordTime time.Time Source string LogName string Content string }
func (*DefaultLogRecord) Format ¶
func (r *DefaultLogRecord) Format(format string) string
func (*DefaultLogRecord) GetCreated ¶
func (r *DefaultLogRecord) GetCreated() time.Time
func (*DefaultLogRecord) GetLevel ¶
func (r *DefaultLogRecord) GetLevel() Level
type DefaultLogger ¶
type DefaultLogger struct{}
func (*DefaultLogger) Close ¶
func (logger *DefaultLogger) Close()
func (*DefaultLogger) Debug ¶
func (logger *DefaultLogger) Debug(content interface{}, args ...interface{})
func (*DefaultLogger) Error ¶
func (logger *DefaultLogger) Error(content interface{}, args ...interface{})
func (*DefaultLogger) Fatal ¶
func (logger *DefaultLogger) Fatal(content interface{}, args ...interface{})
func (*DefaultLogger) Info ¶
func (logger *DefaultLogger) Info(content interface{}, args ...interface{})
func (*DefaultLogger) IsDebugEnable ¶
func (logger *DefaultLogger) IsDebugEnable() bool
func (*DefaultLogger) IsErrorEnable ¶
func (logger *DefaultLogger) IsErrorEnable() bool
func (*DefaultLogger) IsInfoEnable ¶
func (logger *DefaultLogger) IsInfoEnable() bool
func (*DefaultLogger) IsWarnEnable ¶
func (logger *DefaultLogger) IsWarnEnable() bool
func (*DefaultLogger) Log ¶
func (logger *DefaultLogger) Log(content interface{}, args ...interface{})
func (*DefaultLogger) Warn ¶
func (logger *DefaultLogger) Warn(content interface{}, args ...interface{})
type FileLogWriter ¶
type FileLogWriter struct { MaxSize uint64 Daily bool ExpireDays uint Compress bool // contains filtered or unexported fields }
func (*FileLogWriter) Close ¶
func (w *FileLogWriter) Close()
func (*FileLogWriter) GetCallerLevelSkip ¶
func (w *FileLogWriter) GetCallerLevelSkip() uint
func (*FileLogWriter) Log ¶
func (w *FileLogWriter) Log(r LogRecord)
func (*FileLogWriter) Open ¶
func (w *FileLogWriter) Open() error
type HTTPLogWriter ¶
type HTTPLogWriter struct {
// contains filtered or unexported fields
}
func (*HTTPLogWriter) Close ¶
func (w *HTTPLogWriter) Close()
func (*HTTPLogWriter) GetCallerLevelSkip ¶
func (w *HTTPLogWriter) GetCallerLevelSkip() uint
func (*HTTPLogWriter) Log ¶
func (w *HTTPLogWriter) Log(r LogRecord)
func (*HTTPLogWriter) Open ¶
func (w *HTTPLogWriter) Open() error
type JLogger ¶
type JLogger struct {
// contains filtered or unexported fields
}
func (*JLogger) IsDebugEnable ¶
func (*JLogger) IsErrorEnable ¶
func (*JLogger) IsInfoEnable ¶
func (*JLogger) IsWarnEnable ¶
type Log ¶
type Log struct { Logger Logger // contains filtered or unexported fields }
func (*Log) IsDebugEnable ¶
func (*Log) IsErrorEnable ¶
func (*Log) IsInfoEnable ¶
func (*Log) IsWarnEnable ¶
type Logger ¶
type Logger interface { Fatal(content interface{}, args ...interface{}) IsErrorEnable() bool Error(content interface{}, args ...interface{}) IsWarnEnable() bool Warn(content interface{}, args ...interface{}) IsInfoEnable() bool Info(content interface{}, args ...interface{}) IsDebugEnable() bool Debug(content interface{}, args ...interface{}) Log(content interface{}, args ...interface{}) Close() }
func CreateDefaultLogger ¶
func CreateJLogger ¶
type LoggerFactory ¶
type SyncAppender ¶
type SyncAppender struct {
// contains filtered or unexported fields
}
func (*SyncAppender) AddWriter ¶
func (s *SyncAppender) AddWriter(name string, writer LogWriter)
func (*SyncAppender) Close ¶
func (s *SyncAppender) Close()
func (*SyncAppender) Log ¶
func (s *SyncAppender) Log(level Level, name string, content interface{}, args ...interface{})
Click to show internal directories.
Click to hide internal directories.