Documentation
¶
Overview ¶
Package component provides log lifecycle integration for bootstrap.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Component ¶
func Component() bootstrap.IComponent
Component initialises the logging system from env configuration. It reads log.level, log.file.path and related keys during Init().
No configuration is accepted at construction time to prevent accidental calls to env.Env() before the env component has been initialised.
Example ¶
ExampleComponent shows how log.Component() is used as the second argument to bootstrap.New(). It reads log configuration from env during Init() and flushes the async write buffer during Close() — which is called absolutely last by the framework so no cleanup log messages are lost.
package main
import (
"fmt"
logComp "github.com/phcp-tech/common-library-golang/log/component"
)
func main() {
c := logComp.Component()
fmt.Println(c != nil)
fmt.Println(c.Name())
}
Output: true log
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.