README
¶
clogger
a very basic wrapper around log.Logger and syslog that provides a common interface and severity filtering
Usage
package main
import (
"github.com/cromega/clogger"
"os"
)
func main() {
var logger clogger.Logger
target := os.Getenv("LOG")
if target == "local" {
logger = clogger.CreateIoWriter(os.Stdout)
} else {
logger = clogger.CreateSyslog("udp", "logs2.papertrailapp:12345", "app")
}
logger.SetLevel(clogger.Debug)
logger.Info("logging is awesome")
}
Levels are Debug, Info, Warning, Error, Fatal (Critical) and Off.
Documentation
¶
Index ¶
Constants ¶
View Source
const ( Off = iota Fatal Error Warning Info Debug )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger interface { Debug(format string, args ...interface{}) Info(format string, args ...interface{}) Warning(format string, args ...interface{}) Error(format string, args ...interface{}) Fatal(format string, args ...interface{}) SetLevel(level int) Close() }
func CreateIoWriter ¶
func CreateSyslog ¶
Click to show internal directories.
Click to hide internal directories.