Skip to content

phogolabs/log

Repository files navigation

LOG

Documentation License Build Status Coverage Go Report Card

A simple logger for Golang

Installation

$ go get -u github.com/phogolabs/log

Getting started

import (
  "github.com/phogolabs/log"
  "github.com/phogolabs/log/console"
)

log.SetHandler(console.New(os.Stdout))

logger := log.WithFields(log.F("app", "service-api"))
logger.Info("Hello")

Levels

Level Description
DEBUG Info useful to developers for debugging the application not useful during operations.
INFO Normal operational messages - may be harvested for reporting measuring throughput etc. - no action required.
NOTICE Normal but significant condition. Events that are unusual but not error conditions - might be summarized in an email to developers or admins to spot potential problems - no immediate action required.
WARN Warning messages not an error but indication that an error will occur if action is not taken e.g. file system 85% full - each item must be resolved within a given time.
ERROR Non-urgent failures; these should be relayed to developers or admins; each item must be resolved within a given time.
PANIC "A ""panic"" condition usually affecting multiple apps/servers/sites. At this level it would usually notify all tech staff on call."
ALERT "Action must be taken immediately. Should be corrected immediately, therefore notify staff who can fix the problem. An example would be the loss of a primary ISP connection."
FATAL "Should be corrected immediately, but indicates failure in a primary system; an example is a loss of a backup ISP connection. (same as SYSLOG CRITICAL)"

Contributing

We are open for any contributions. Just fork the project.

About

A simple logging library for golang

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages