Documentation
¶
Overview ¶
Package control implements necessary functionality for runtime level toggling. A control file is used as level configuration. The file content is memory mapped in the process to do real time lookup when a log messages is created.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultControlPath is where the default log control instance will store its control file DefaultControlPath string // FATAL, ERROR, WARNING, INFO, DEBUG DefaultLevelString = fmt.Sprintf(" %3s %3s %3s %3s %3s", "ON", "ON", "ON", "ON", "OFF") )
Functions ¶
func ApplicationAndComponentToKey ¶
ApplicationAndComponentToKey builds the lookup key format used by S
Types ¶
type ControlLine ¶
type ControlLine struct {
Application string
Component string
Ptr ControlPtr
}
type ControlPtr ¶
type ControlPtr []byte
func (ControlPtr) ShouldLog ¶
func (p ControlPtr) ShouldLog(level Level) bool
type Level ¶
type Level int
Level is the type used to specify a log message level fatal, error, warning, info or debug
type LogControl ¶
type LogControl struct {
ControlPath string
// contains filtered or unexported fields
}
func MaybeNewGlobalLogControl ¶
func MaybeNewGlobalLogControl() *LogControl
MaybeNewGlobalLogControl returns the cached global LogControl instance. The LogControl instance is created on the first invocation of the function.
func NewLogControl ¶
func NewLogControl(controlPath string) *LogControl
func (*LogControl) Lock ¶
func (c *LogControl) Lock() (func() error, error)
func (*LogControl) OpenForUpdate ¶
func (c *LogControl) OpenForUpdate() (*LogControlForUpdate, error)
func (*LogControl) ReadControlFile ¶
func (c *LogControl) ReadControlFile() error
func (*LogControl) Register ¶
func (c *LogControl) Register(application, component string) error
type LogControlForUpdate ¶
type LogControlForUpdate struct {
*LogControl
// contains filtered or unexported fields
}
func (*LogControlForUpdate) Close ¶
func (c *LogControlForUpdate) Close() error
func (*LogControlForUpdate) Flush ¶
func (c *LogControlForUpdate) Flush() error
func (*LogControlForUpdate) ParseControl ¶
func (c *LogControlForUpdate) ParseControl() ([]*WritableControlLine, error)
type WritableControlLine ¶
type WritableControlLine struct {
*ControlLine
Ptr WritableControlPtr
}
type WritableControlPtr ¶
type WritableControlPtr ControlPtr
func (WritableControlPtr) Off ¶
func (p WritableControlPtr) Off(level Level)
Off disables a log level
func (WritableControlPtr) ShouldLog ¶
func (p WritableControlPtr) ShouldLog(level Level) bool
ShouldLog is a proxy for (p ControlPtr) ShouldLog(Level)
Click to show internal directories.
Click to hide internal directories.