Documentation ¶
Index ¶
- func CustomLogInit(level logrus.Level) *logrus.Logger
- func DiscardBootReason(log *base.LogObject)
- func DiscardRebootImage(log *base.LogObject)
- func DiscardRebootReason(log *base.LogObject)
- func DumpAllStacks(log *base.LogObject, agentName string)
- func EveCurrentPartition() string
- func EveVersion() string
- func GetBootReason(log *base.LogObject) (types.BootReason, time.Time)
- func GetGlobalConfig(log *base.LogObject, sub pubsub.Subscription) *types.ConfigItemValueMap
- func GetLogLevel(log *base.LogObject, sub pubsub.Subscription, agentName string) (string, bool)
- func GetLogLevelNoDefault(log *base.LogObject, sub pubsub.Subscription, agentName string) (string, bool)
- func GetMyStack() string
- func GetRebootImage(log *base.LogObject) string
- func GetRebootReason(log *base.LogObject) (string, time.Time, string)
- func GetRemoteLogLevel(log *base.LogObject, sub pubsub.Subscription, agentName string) (string, bool)
- func GetRemoteLogLevelNoDefault(log *base.LogObject, sub pubsub.Subscription, agentName string) (string, bool)
- func HandleGlobalConfig(log *base.LogObject, sub pubsub.Subscription, agentName string, ...) *types.ConfigItemValueMap
- func Init(agentName string) (*logrus.Logger, *base.LogObject)
- func LogLevel(gc *types.ConfigItemValueMap, agentName string) string
- func PrintStacks(log *base.LogObject)
- func RebootReason(reason string, bootReason types.BootReason, agentName string, agentPid int, ...)
- func RebootStack(log *base.LogObject, stacks string, agentName string, agentPid int)
- type FatalHook
- type Loginfo
- type MemAllocationSite
- type SkipCallerHook
- type SourceHook
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CustomLogInit ¶
CustomLogInit - allow pillar services and containers to use customized logging
func DiscardBootReason ¶
DiscardBootReason removes the BootReason file
func DiscardRebootImage ¶
DiscardRebootImage : Discard the last reboot-image file
func DiscardRebootReason ¶
DiscardRebootReason removes any reason and stack from /persist/
func DumpAllStacks ¶
DumpAllStacks writes to file but does not log
func EveCurrentPartition ¶
func EveCurrentPartition() string
EveCurrentPartition returns the current EVE image partition
func GetBootReason ¶
GetBootReason returns the BootReason enum, which is stored as a string in /persist, together with its timestamp
func GetGlobalConfig ¶
func GetGlobalConfig(log *base.LogObject, sub pubsub.Subscription) *types.ConfigItemValueMap
func GetLogLevel ¶
Returns (value, ok)
func GetLogLevelNoDefault ¶
func GetMyStack ¶
func GetMyStack() string
GetMyStack is used to log stack traces at certain call sites Excludes ourselves
func GetRebootImage ¶
GetRebootImage : Image from which the reboot happened
func GetRebootReason ¶
GetRebootReason returns the RebootReason string together with its timestamp plus the reboot stack. We limit the size we read to 16k for the RebootReason and to 512k for the stack, because in case of a kernel crash, the stack file contains the whole dmesg, which kernel buffer is limited to some reasonable value below 512k.
func GetRemoteLogLevel ¶
func GetRemoteLogLevel(log *base.LogObject, sub pubsub.Subscription, agentName string) (string, bool)
Returns (value, ok)
func HandleGlobalConfig ¶
func HandleGlobalConfig(log *base.LogObject, sub pubsub.Subscription, agentName string, debugOverride bool, logger *logrus.Logger) *types.ConfigItemValueMap
HandleGlobalConfig updates the LogLevel setting in the passed in logger based on GlobalConfig and debugOverride
func RebootReason ¶
func RebootReason(reason string, bootReason types.BootReason, agentName string, agentPid int, normal bool)
RebootReason writes a reason string in /persist/reboot-reason, including agentName and date It also appends to /persist/log/reboot-reason.log If the bootReasonFile is not present it will write the bootReason enum there as a string. That ensures that if we have a e.g., a log.Fatal followed by watchdog we retain the fatal. NOTE: can not use log here since we are called from a log hook!
Types ¶
type FatalHook ¶
type FatalHook struct {
// contains filtered or unexported fields
}
FatalHook is used make sure we save the fatal and panic strings to a file
type Loginfo ¶
type Loginfo struct { Level string `json:"level"` Time string `json:"time"` // RFC3339 with Nanoseconds Msg string `json:"msg"` Pid int `json:"pid"` Function string `json:"func"` Filename string `json:"file"` Source string `json:"source"` Appuuid string `json:"appuuid"` Containername string `json:"containername"` Eventtime string `json:"eventtime"` }
Extend this structure with optional specific tags from log.WithFields
type MemAllocationSite ¶
type MemAllocationSite struct { InUseBytes int64 InUseObjects int64 AllocBytes int64 AllocObjects int64 PrintedStack string }
MemAllocationSite is the return value of GetMemProfile
func GetMemAllocationSites ¶
func GetMemAllocationSites(reportZeroInUse bool) (int, []MemAllocationSite)
GetMemAllocationSites returns the non-zero allocation sites in the form of an array of strings; each string is for one allocation call site. If reportZeroInUse is set it also reports with zero InUse.
type SkipCallerHook ¶
type SkipCallerHook struct { }
SkipCallerHook is used to skip to the "base" package entry in the stack
func (*SkipCallerHook) Fire ¶
func (hook *SkipCallerHook) Fire(entry *logrus.Entry) error
Fire does the skipping
func (*SkipCallerHook) Levels ¶
func (hook *SkipCallerHook) Levels() []logrus.Level
Levels installs the SkipCallerHook for all levels
type SourceHook ¶
type SourceHook struct {
// contains filtered or unexported fields
}
SourceHook is used to add source and pid if not already set
func (*SourceHook) Fire ¶
func (hook *SourceHook) Fire(entry *logrus.Entry) error
Fire adds source and pid if not already set
func (*SourceHook) Levels ¶
func (hook *SourceHook) Levels() []logrus.Level
Levels installs the SourceHook for all levels