dlog

package module
v0.0.0-...-443b333 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2023 License: BSD-2-Clause Imports: 9 Imported by: 26

README

dlog

Go's standard logger is fairly limited. As result, kazilion alternatives loggers have been written.

All of these are wonderful. They can make your logs look colorful and pretty, buffer things in complicated ways, format data for ElasticSearch, and more.

Cool, but all I wanted is something super dumb, that just exposes log.Info(), log.Error() and a couple other standard levels.

I don't need a super flexible kitchen sink. Just something super basic and trivial to use. I just want it to handle different log levels, and be able to write simple logs to stderr, to a local file, to syslog and to the Windows event log.

So, here's one more logging library for Go. The dumbest of them all. Enjoy.

Documentation

Overview

Example
Init("example", SeverityNotice, "")
// Call flag.Parse() around that time
Info("Application is starting")
Debugf("Counter value: %d", 0)
Fatal("Kaboom")
Output:

Index

Examples

Constants

This section is empty.

Variables

View Source
var SeverityName = []string{
	SeverityDebug:    "DEBUG",
	SeverityInfo:     "INFO",
	SeverityNotice:   "NOTICE",
	SeverityWarning:  "WARNING",
	SeverityError:    "ERROR",
	SeverityCritical: "CRITICAL",
	SeverityFatal:    "FATAL",
}

Functions

func Critical

func Critical(message interface{})

func Criticalf

func Criticalf(format string, args ...interface{})

func Debug

func Debug(message interface{})

func Debugf

func Debugf(format string, args ...interface{})

func Error

func Error(message interface{})

func Errorf

func Errorf(format string, args ...interface{})

func Fatal

func Fatal(message interface{})

func Fatalf

func Fatalf(format string, args ...interface{})

func GetFileDescriptor

func GetFileDescriptor() *os.File

func Info

func Info(message interface{})

func Infof

func Infof(format string, args ...interface{})

func Init

func Init(appName string, logLevel Severity, syslogFacility string) error

func Notice

func Notice(message interface{})

func Noticef

func Noticef(format string, args ...interface{})

func SetFileDescriptor

func SetFileDescriptor(fd *os.File)

func SetLogLevel

func SetLogLevel(logLevel Severity)

func TruncateLogFile

func TruncateLogFile(value bool)

func UseLogFile

func UseLogFile(fileName string)

func UseSyslog

func UseSyslog(value bool)

func Warn

func Warn(message interface{})

func Warnf

func Warnf(format string, args ...interface{})

Types

type Severity

type Severity int32
const (
	SeverityDebug Severity = iota
	SeverityInfo
	SeverityNotice
	SeverityWarning
	SeverityError
	SeverityCritical
	SeverityFatal
	SeverityLast
)

func LogLevel

func LogLevel() Severity

func (*Severity) Get

func (s *Severity) Get() interface{}

func (*Severity) Set

func (s *Severity) Set(strVal string) error

func (*Severity) String

func (s *Severity) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL