Documentation
¶
Index ¶
- func GetConfigString(configInfos *CBLOGCONFIG) string
- func GetLevel() string
- func GetLogger(loggerName string) *logrus.Logger
- func GetLoggerWithConfigPath(loggerName string, configFilePath string) *logrus.Logger
- func ReplaceEnvPath(str string) string
- func SetLevel(strLevel string)
- type CBLOGCONFIG
- type CBLogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetConfigString ¶
func GetConfigString(configInfos *CBLOGCONFIG) string
func GetLogger ¶
Get the logger with name you set. The name will be used as below (name: CB-SPIDER) [CB-SPIDER].[INFO]: 2020-12-24 16:54:46 sample-with-config-path.go:27, main.main() - start......... Read configuration file (log_conf.yaml) by the path set on environment variable (e.g., $CBLOG_ROOT)
func GetLoggerWithConfigPath ¶
Read configuration file (log_conf.yaml) from the path you set
Types ¶
type CBLOGCONFIG ¶
type CBLOGCONFIG struct {
CBLOG struct {
LOGLEVEL string
CONSOLE bool
LOGFILE bool
}
LOGFILEINFO struct {
FILENAME string
MAXSIZE int
MAXBACKUPS int
MAXAGE int
}
}
func GetConfigInfos ¶
func GetConfigInfos(configFilePath string) CBLOGCONFIG
GetConfigInfos reads the configuration from the given path (or $CBLOG_ROOT/conf/log_conf.yaml). It calls log.Fatalf on error and is intended for initial startup only.
func GetConfigInfosSafe ¶ added in v0.11.1
func GetConfigInfosSafe(configFilePath string) (CBLOGCONFIG, error)
GetConfigInfosSafe is like GetConfigInfos but returns an error instead of calling log.Fatalf. This is used for runtime config reloads where a transient failure (e.g. file not yet available during atomic save) should not terminate the process.
func NewCBLOGCONFIG ¶ added in v0.8.1
func NewCBLOGCONFIG() CBLOGCONFIG
Directories
¶
| Path | Synopsis |
|---|---|
|
Dynamic log-level test: demonstrates that editing loglevel in the config file is picked up automatically by the always-on file watcher.
|
Dynamic log-level test: demonstrates that editing loglevel in the config file is picked up automatically by the always-on file watcher. |