log

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2018 License: GPL-3.0 Imports: 4 Imported by: 1

README

log

Go Report Card

This package provides a simple log extension for the default API in log.

Table of Contents

Installation

From Source
go get -u github.com/andygeiss/log

Usage

The following example sets the Log-Level from Info to Warn and prints a few log messages to stdout.

log.Level = log.LevelWarn // switch from Info to Warn
log.Debug("4 CPUs found.")
log.Info("Starting ...")
log.Warn("No parameters set!")
log.Error("Action failed! Shutdown is recommended!")
log.Fatal("Action failed! Shutting down...")
log.Warn("Never reached.")

The output will be:

2018/11/26 16:16:14 WARN  | 929ns            | No parameters set!                      
2018/11/26 16:16:14 ERROR | 194.941µs        | Action failed! Shutdown is recommended! 
2018/11/26 16:16:14 FATAL | 134.146µs        | Action failed! Shutting down...

Documentation

Index

Constants

View Source
const (
	LevelDebug = 0
	LevelInfo  = 1
	LevelWarn  = 2
	LevelError = 3
	LevelFatal = 4
)

Variables

View Source
var (
	// Level represents the current state (Info ist default)
	Level int = LevelInfo
)

Functions

func Debug

func Debug(msg string)

Debug ...

func Error

func Error(msg string)

Error ...

func Fatal

func Fatal(msg string)

Fatal ...

func Info

func Info(msg string)

Info ...

func Warn

func Warn(msg string)

Warn ...

Types

This section is empty.

Jump to

Keyboard shortcuts

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