Documentation
¶
Overview ¶
Package logger provides functions to log on different levels/severities. Levels have a canonical ordering and there is support silencing log statements with levels below a given threshold.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Debug ¶
func Debug(v ...interface{})
Debug logging.
Example ¶
Log on "debug" level.
package main
import (
"github.com/bpicode/fritzctl/logger"
)
func main() {
logger.Debug("debug message")
}
func Error ¶ added in v1.4.8
func Error(v ...interface{})
Error logging in red.
Example ¶
Log on "error" level.
package main
import (
"github.com/bpicode/fritzctl/logger"
)
func main() {
logger.Error("an error occurred")
}
func Info ¶
func Info(v ...interface{})
Info logging.
Example ¶
Log on "info" level.
package main
import (
"github.com/bpicode/fritzctl/logger"
)
func main() {
logger.Info("informational message")
}
Types ¶
type Level ¶ added in v1.4.17
type Level struct {
}
Level represents a Value for different logging configs.
Example ¶
Level can be used with the flag package.
package main
import (
"flag"
"github.com/bpicode/fritzctl/logger"
)
func main() {
l := logger.Level{}
flag.Var(&l, "log", "logging verbosity, e.g. 'info'")
flag.Parse()
}
func (*Level) Set ¶ added in v1.4.17
Set configures the loglevel for the application.
Example ¶
Logging can be turned off manually.
package main
import (
"github.com/bpicode/fritzctl/logger"
)
func main() {
l := &logger.Level{}
l.Set("none")
logger.Warn("log statement")
}
Click to show internal directories.
Click to hide internal directories.