Documentation
¶
Index ¶
- Constants
- func SetGlobalLogger(logger *Logger)
- type LogLevel
- type Logger
- func (l *Logger) Close() error
- func (l *Logger) Debug(format string, args ...interface{})
- func (l *Logger) DisableFileLogging() error
- func (l *Logger) EnableFileLogging(logPath string) error
- func (l *Logger) Error(format string, args ...interface{})
- func (l *Logger) GetLevel() LogLevel
- func (l *Logger) Info(format string, args ...interface{})
- func (l *Logger) Rotate() error
- func (l *Logger) SetLevel(level LogLevel)
- func (l *Logger) SetMaxFiles(count int)
- func (l *Logger) SetMaxSize(size int64)
- func (l *Logger) Success(format string, args ...interface{})
- func (l *Logger) Tip(format string, args ...interface{})
- func (l *Logger) Warning(format string, args ...interface{})
Constants ¶
View Source
const ( // DefaultLogDir 默认日志目录 DefaultLogDir = "~/.sshx" // DefaultLogFile 默认日志文件名 DefaultLogFile = "sshx.log" // DefaultMaxFiles 默认保留的日志文件数量 DefaultMaxFiles = 3 // DefaultMaxSize 默认单个日志文件最大大小(10MB) DefaultMaxSize = 10 * 1024 * 1024 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type LogLevel ¶
type LogLevel int
LogLevel 定义日志级别
func LogLevelFromString ¶
LogLevelFromString 从字符串解析日志级别
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger 统一的日志记录器
func (*Logger) DisableFileLogging ¶
DisableFileLogging 禁用文件日志
func (*Logger) EnableFileLogging ¶
EnableFileLogging 启用文件日志 logPath: 日志文件路径,如果为空则使用默认路径 ~/.sshx/sshx.log
Click to show internal directories.
Click to hide internal directories.