Documentation
¶
Index ¶
- Constants
- Variables
- func Create(path string)
- func Debug(args ...interface{})
- func Debugf(format string, args ...interface{})
- func DisableLogMetric()
- func EnableFileLog()
- func EnableLogMetric()
- func EnableLongFilePath()
- func Error(args ...interface{})
- func Errorf(format string, args ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(format string, args ...interface{})
- func GetModuleName() string
- func Info(args ...interface{})
- func Infof(format string, args ...interface{})
- func Init(cfg Config)
- func SetCallerPrettyfier(f func(*runtime.Frame) (file string))
- func SetCluster(c string)
- func SetCustomFields(fields Fields)
- func SetLevel(level LogLevel)
- func SetLogFormat(format logFormat)
- func SetModuleName(n string)
- func SetOutput(w io.Writer)
- func SetOutputLogger(l *Logger)
- func SetRegion(r Region)
- func SetReportCaller(b bool)
- func SetSkipCallerDepth(depth int)
- func SetTraceOutput(w io.Writer)
- func SetVersion(version string)
- func SuccinctCallerPath(f *runtime.Frame) string
- func Trace(trace *RequestTrace)
- func Warn(args ...interface{})
- func Warnf(format string, args ...interface{})
- func WithRequestTrace(ctx context.Context, trace *RequestTrace) context.Context
- type BufferPool
- type Config
- type ConsoleWriter
- type DateType
- type DateWriter
- type Entry
- func (entry *Entry) Debug(v ...interface{})
- func (entry *Entry) Debugf(format string, v ...interface{})
- func (entry *Entry) Error(v ...interface{})
- func (entry *Entry) Errorf(format string, v ...interface{})
- func (entry *Entry) Fatal(v ...interface{})
- func (entry *Entry) Fatalf(format string, v ...interface{})
- func (entry *Entry) GetFields() Fields
- func (entry *Entry) Info(v ...interface{})
- func (entry *Entry) Infof(format string, v ...interface{})
- func (entry *Entry) Warn(v ...interface{})
- func (entry *Entry) Warnf(format string, v ...interface{})
- func (entry *Entry) WithContext(ctx context.Context) *Entry
- func (entry *Entry) WithFields(fields Fields) *Entry
- type ErrorCode
- type Fields
- type HourWriter
- type LogLevel
- type Logger
- func (logger *Logger) Debug(v ...interface{})
- func (logger *Logger) Debugf(format string, v ...interface{})
- func (logger *Logger) EnableFileLog()
- func (logger *Logger) Error(v ...interface{})
- func (logger *Logger) Errorf(format string, v ...interface{})
- func (logger *Logger) Fatal(v ...interface{})
- func (logger *Logger) Fatalf(format string, v ...interface{})
- func (logger *Logger) GetCustomFields() Fields
- func (logger *Logger) Info(v ...interface{})
- func (logger *Logger) Infof(format string, v ...interface{})
- func (logger *Logger) IsConsoleWriter() bool
- func (logger *Logger) SetConsole()
- func (logger *Logger) SetCustomFields(fields Fields)
- func (logger *Logger) SetDayRoller(logpath string, num int) error
- func (logger *Logger) SetFileRoller(logpath string, num int, sizeMB int) error
- func (logger *Logger) SetHourRoller(logpath string, num int) error
- func (logger *Logger) SetLogFormat(format logFormat)
- func (logger *Logger) SetLogName(name string)
- func (logger *Logger) SetOutput(w io.Writer)
- func (logger *Logger) Warn(v ...interface{})
- func (logger *Logger) Warnf(format string, v ...interface{})
- func (logger *Logger) WithContext(ctx context.Context) *Entry
- func (logger *Logger) WithFields(fields Fields) *Entry
- func (l *Logger) WriteLog(msg []byte)
- type Net
- type Region
- type RemoteConfig
- type RequestTrace
- type RollFileWriter
Constants ¶
View Source
const ( KeyRequestID contextKey = "request_id" KeyAction contextKey = "action" KeyCaller contextKey = "caller" KeyCallee contextKey = "callee" KeyCallerIp contextKey = "caller_ip" KeyCalleeEndpoint contextKey = "callee_endpoint" KeyCalleeAction contextKey = "callee_action" KeyRetCode contextKey = "retcode" KeyCostTime contextKey = "cost_time" KeyNamespace contextKey = "namespace" KeyInstanceId contextKey = "instance_id" KeyAppID contextKey = "app_id" KeyModuleVersion contextKey = "version" KeyContainerId contextKey = "container_id" KeyRegion contextKey = "region" KeyCluster contextKey = "cluster" KeyCalleeCluster contextKey = "callee_cluster" KeyFunctionType contextKey = "function_type" KeyDeployMode contextKey = "deploy_mode" KeyInstanceType contextKey = "instance_type" )
View Source
const ( KeyAlarmType contextKey = "alarm_type" KeyAlarmName contextKey = "alarm_name" )
View Source
const ( TextFormat logFormat = iota JSONFormat )
Variables ¶
View Source
var (
CallerPrettyfier func(*runtime.Frame) (file string)
)
View Source
var LocalIP string
Functions ¶
func DisableLogMetric ¶
func DisableLogMetric()
func EnableFileLog ¶
func EnableFileLog()
func EnableLogMetric ¶
func EnableLogMetric()
func EnableLongFilePath ¶
func EnableLongFilePath()
func GetModuleName ¶
func GetModuleName() string
func SetCallerPrettyfier ¶
func SetCluster ¶
func SetCluster(c string)
func SetCustomFields ¶
func SetCustomFields(fields Fields)
func SetLogFormat ¶
func SetLogFormat(format logFormat)
func SetModuleName ¶
func SetModuleName(n string)
func SetOutputLogger ¶
func SetOutputLogger(l *Logger)
func SetReportCaller ¶
func SetReportCaller(b bool)
func SetSkipCallerDepth ¶
func SetSkipCallerDepth(depth int)
func SetTraceOutput ¶
func SetVersion ¶
func SetVersion(version string)
func SuccinctCallerPath ¶
func Trace ¶
func Trace(trace *RequestTrace)
func WithRequestTrace ¶
func WithRequestTrace(ctx context.Context, trace *RequestTrace) context.Context
Types ¶
type ConsoleWriter ¶
type ConsoleWriter struct {
}
type DateWriter ¶
type DateWriter struct {
// contains filtered or unexported fields
}
func NewDateWriter ¶
func NewDateWriter(logpath, name string, dateType DateType, num int) *DateWriter
type Entry ¶
type Entry struct {
// contains filtered or unexported fields
}
func WithContext ¶
func WithFields ¶
func (*Entry) WithFields ¶
type Fields ¶
type Fields map[string]interface{}
export type Fields
func GetCustomFields ¶
func GetCustomFields() Fields
type HourWriter ¶
type HourWriter struct {
}
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
func GetDefaultLogger ¶
func GetDefaultLogger() *Logger
func GetLoggerByName ¶
func (*Logger) EnableFileLog ¶
func (logger *Logger) EnableFileLog()
func (*Logger) GetCustomFields ¶
func (*Logger) IsConsoleWriter ¶
func (*Logger) SetConsole ¶
func (logger *Logger) SetConsole()
func (*Logger) SetCustomFields ¶
func (*Logger) SetFileRoller ¶
func (*Logger) SetLogFormat ¶
func (logger *Logger) SetLogFormat(format logFormat)
func (*Logger) SetLogName ¶
func (*Logger) WithFields ¶
type Region ¶
type Region string
const ( RegionGuangzhou Region = "ap-guangzhou" RegionShanghai Region = "ap-shanghai" RegionBeijing Region = "ap-beijing" RegionHongKong Region = "ap-hongkong" RegionChengdu Region = "ap-chengdu" RegionIndia Region = "ap-mumbai" RegionChongqing Region = "ap-chongqing" RegionSeoul Region = "ap-seoul" RegionSingapore Region = "ap-singapore" RegionToronto Region = "na-toronto" RegionSiliconValley Region = "na-siliconvalley" RegionFrankfurt Region = "eu-frankfurt" RegionBangkok Region = "ap-bangkok" )
type RemoteConfig ¶
type RequestTrace ¶
type RequestTrace struct {
DestID int64
Region string
AppID int64
RequestID string
Action string
Qualifier string
InstanceID string
FunctionName string
Namespace string
VersionID string
Timestamp time.Time
Caller string
Callee string
CallerIP string
CalleeEndpoint string
CalleeAction string
ErrorCode ErrorCode
SubErrorCode string
Cost time.Duration
RetCode int64
Version string
Cluster string
ContainerID string
ColdStart float64
Duration int64
ErrorSource string
CvmId string
Runtime string
CalleeCluster string
FunctionType string
DeployMode string
InstanceType string
}
func GetTraceInfo ¶
func GetTraceInfo(ctx context.Context) *RequestTrace
func (*RequestTrace) DeepCopy ¶
func (rt *RequestTrace) DeepCopy() *RequestTrace
func (*RequestTrace) WithCallee ¶
func (rt *RequestTrace) WithCallee(callee string) *RequestTrace
type RollFileWriter ¶
type RollFileWriter struct {
// contains filtered or unexported fields
}
func NewRollFileWriter ¶
func NewRollFileWriter(logpath, name string, num, sizeMB int) *RollFileWriter
Source Files
¶
Click to show internal directories.
Click to hide internal directories.