Documentation ¶
Index ¶
- Constants
- Variables
- func ConfigBaseLogger(pluginName string, options *Options) error
- func ConfigCacheLogger(pluginName string, options *Options) error
- func ConfigDefaultBaseLogger(pluginName string) error
- func ConfigDefaultCacheLogger(pluginName string) error
- func ConfigDefaultDetectLogger(pluginName string) error
- func ConfigDefaultNetworkLogger(pluginName string) error
- func ConfigDefaultStatLogger(pluginName string) error
- func ConfigDefaultStatReportLogger(pluginName string) error
- func ConfigDetectLogger(pluginName string, options *Options) error
- func ConfigNetworkLogger(pluginName string, options *Options) error
- func ConfigStatLogger(pluginName string, options *Options) error
- func ConfigStatReportLogger(pluginName string, options *Options) error
- func RegisterLoggerCreator(name string, creator loggerCreator)
- func SetBaseLogger(logger Logger)
- func SetCacheLogger(logger Logger)
- func SetDetectLogger(logger Logger)
- func SetNetworkLogger(logger Logger)
- func SetStatLogger(logger Logger)
- func SetStatReportLogger(logger Logger)
- func VerifyLogLevel(level int) error
- type DirLogger
- type Logger
- type Options
Constants ¶
View Source
const ( // DefaultLogger 默认logger DefaultLogger = LoggerZap DefaultLogLevel = InfoLog // DefaultBaseLogLevel 默认基础日志级别 DefaultBaseLogLevel = DefaultLogLevel // DefaultStatLogLevel 默认统计日志级别 DefaultStatLogLevel = DefaultLogLevel // DefaultDetectLogLevel 默认探测日志级别 DefaultDetectLogLevel = DefaultLogLevel // DefaultStatReportLogLevel 默认统计上报日志级别 DefaultStatReportLogLevel = DefaultLogLevel // DefaultNetworkLogLevel 默认网络交互日志级别 DefaultNetworkLogLevel = DefaultLogLevel // DefaultCacheLogLevel 默认缓存日志级别 DefaultCacheLogLevel = DefaultLogLevel )
View Source
const ( // DefaultErrorOutputPath 默认直接错误输出路径 DefaultErrorOutputPath = "stderr" // DefaultRotationMaxAge 默认滚动日志保留时间 DefaultRotationMaxAge = 30 // DefaultRotationMaxSize 默认单个日志最大占用空间 DefaultRotationMaxSize = 50 // DefaultRotationMaxBackups 默认最大滚动备份 DefaultRotationMaxBackups = 5 // DefaultLogRotationRootDir 默认日志根目录 DefaultLogRotationRootDir = "./polaris/log" // DefaultBaseLogRotationPath 默认基础日志滚动文件 DefaultBaseLogRotationPath = "/base/polaris.log" // DefaultStatLogRotationPath 默认统计日志滚动文件 DefaultStatLogRotationPath = "/stat/polaris-stat.log" // DefaultStatReportLogRotationPath 默认统计上报日志滚动文件 DefaultStatReportLogRotationPath = "/statReport/polaris-statReport.log" // DefaultDetectLogRotationPath 默认探测日志滚动文件 DefaultDetectLogRotationPath = "/detect/polaris-detect.log" // DefaultNetworkLogRotationPath 默认网络交互日志滚动文件 DefaultNetworkLogRotationPath = "/network/polaris-network.log" // DefaultCacheLogRotationPath 默认缓存更新日志滚动文件 DefaultCacheLogRotationPath = "/cache/polaris-cache.log" // DefaultBaseLogRotationFile 默认基础日志滚动文件全路径 DefaultBaseLogRotationFile = DefaultLogRotationRootDir + DefaultBaseLogRotationPath // DefaultStatLogRotationFile 默认统计日志滚动文件全路径 DefaultStatLogRotationFile = DefaultLogRotationRootDir + DefaultStatLogRotationPath // DefaultStatReportLogRotationFile 默认统计上报日志滚动文件全路径 DefaultStatReportLogRotationFile = DefaultLogRotationRootDir + DefaultStatReportLogRotationPath // DefaultDetectLogRotationFile 默认探测日志滚动文件全路径 DefaultDetectLogRotationFile = DefaultLogRotationRootDir + DefaultDetectLogRotationPath // DefaultNetworkLogRotationFile 默认网络交互日志滚动文件全路径 DefaultNetworkLogRotationFile = DefaultLogRotationRootDir + DefaultNetworkLogRotationPath // DefaultCacheLogRotationFile 默认缓存更新日志滚动文件全路径 DefaultCacheLogRotationFile = DefaultLogRotationRootDir + DefaultCacheLogRotationPath )
View Source
const ( // TraceLog 跟踪级别 TraceLog int = iota // DebugLog 调试级别 DebugLog // InfoLog 一般日志级别 InfoLog // WarnLog 警告日志级别 WarnLog // ErrorLog 错误日志级别 ErrorLog // FatalLog 致命级别 FatalLog // NoneLog 当要禁止日志的时候,可以设置此级别 NoneLog )
View Source
const ( // BaseLogger 基础日志对象 BaseLogger = iota // StatLogger 统计日志对象 StatLogger // StatReportLogger 统计日志上报对象,记录上报日志的情况 StatReportLogger // DetectLogger 探测日志对象 DetectLogger // NetworkLogger 与系统服务进行网络交互的相关日志 NetworkLogger // CacheLogger 缓存更新日志 CacheLogger // MaxLogger 日志对象总量 MaxLogger )
日志类型
View Source
const (
// LoggerZap zap实现的logger
LoggerZap = "zaplog"
)
Variables ¶
View Source
var SeverityName = []string{ TraceLog: "TRACE", DebugLog: "DEBUG", InfoLog: "INFO", WarnLog: "WARNING", ErrorLog: "ERROR", FatalLog: "FATAL", }
SeverityName severity Name contains the string representation of each severity.
Functions ¶
func ConfigBaseLogger ¶
ConfigBaseLogger 配置基础日志器
func ConfigCacheLogger ¶
ConfigCacheLogger 配置缓存日志器
func ConfigDefaultBaseLogger ¶
ConfigDefaultBaseLogger 配置默认的基础日志器
func ConfigDefaultCacheLogger ¶
ConfigDefaultCacheLogger 配置默认的缓存日志器
func ConfigDefaultDetectLogger ¶
ConfigDefaultDetectLogger 配置默认的探测日志器
func ConfigDefaultNetworkLogger ¶
ConfigDefaultNetworkLogger 配置默认的网络交互日志器
func ConfigDefaultStatLogger ¶
ConfigDefaultStatLogger 配置默认的统计日志器
func ConfigDefaultStatReportLogger ¶
ConfigDefaultStatReportLogger 配置默认的统计上报日志器
func ConfigDetectLogger ¶
ConfigDetectLogger 配置探测日志器
func ConfigNetworkLogger ¶
ConfigNetworkLogger 配置网络交互日志器
func ConfigStatLogger ¶
ConfigStatLogger 配置统计日志器
func ConfigStatReportLogger ¶
ConfigStatReportLogger 配置统计上报日志器
func RegisterLoggerCreator ¶
func RegisterLoggerCreator(name string, creator loggerCreator)
RegisterLoggerCreator 注册Logger插件
Types ¶
type Logger ¶
type Logger interface { // Tracef 打印trace级别的日志 Tracef(format string, args ...interface{}) // Debugf 打印debug级别的日志 Debugf(format string, args ...interface{}) // Infof 打印info级别的日志 Infof(format string, args ...interface{}) // Warnf 打印warn级别的日志 Warnf(format string, args ...interface{}) // Errorf 打印error级别的日志 Errorf(format string, args ...interface{}) // Fatalf 打印fatalf级别的日志 Fatalf(format string, args ...interface{}) // IsLevelEnabled 判断当前级别是否满足日志打印的最低级别 IsLevelEnabled(l int) bool // SetLogLevel 动态设置日志打印级别 SetLogLevel(l int) error }
Logger logger object @brief 日志对象,封装了日志打印的接口逻辑
type Options ¶
type Options struct { // OutputPaths is a list of file system paths to write the log data to. // The special values stdout and stderr can be used to output to the // standard I/O streams. This defaults to stdout. OutputPaths []string // ErrorOutputPaths is a list of file system paths to write logger errors to. // The special values stdout and stderr can be used to output to the // standard I/O streams. This defaults to stderr. ErrorOutputPaths []string // RotateOutputPath is the path to a rotating log file. This file should // be automatically rotated over time, based on the rotation parameters such // as RotationMaxSize and RotationMaxAge. The default is to not rotate. // // This path is used as a foundational path. This is where log output is normally // saved. When a rotation needs to take place because the file got too big or too // old, then the file is renamed by appending a timestamp to the name. Such renamed // files are called backups. Once a backup has been created, // output resumes to this path. RotateOutputPath string // RotationMaxSize is the maximum size in megabytes of a log file before it gets // rotated. It defaults to 100 megabytes. RotationMaxSize int // RotationMaxAge is the maximum number of days to retain old log files based on the // timestamp encoded in their filename. Note that a day is defined as 24 // hours and may not exactly correspond to calendar days due to daylight // savings, leap seconds, etc. The default is to remove log files // older than 30 days. RotationMaxAge int // RotationMaxBackups is the maximum number of old log files to retain. The default // is to retain at most 1000 logs. RotationMaxBackups int // The min log level that actual log output LogLevel int }
Options defines the set of options for component logging package.
func CreateDefaultLoggerOptions ¶
CreateDefaultLoggerOptions 配置默认的日志插件
Click to show internal directories.
Click to hide internal directories.