logger

package module
v0.0.0-...-109b4aa Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2016 License: MIT Imports: 2 Imported by: 1

README

Levels for logging

GoDoc Go Report Card MIT License Build Status

To get package:

go get github.com/baijum/logger

Environment variable "LOG_LEVEL" set the log level. These are the possible values: DEBUG, INFO, WARNING, and ERROR

Log level can be set from the code like this:

logger.SetLevel(logger.WARNING)

To log a message, compare the current level with available levels:

if logger.Level <= logger.INFO {
	log.Printf("Some log message")
}

if logger.Level <= logger.WARNING {
	log.Printf("Some log message")
}

Documentation

Overview

Package logger implements levels for logging

To get package:

go get github.com/baijum/logger

Environment variable "LOG_LEVEL" set the log level. These are the possible values: DEBUG, INFO, WARNING, and ERROR

Log level can be set from the code like this:

logger.SetLevel(logger.WARNING)

To log a message, compare the current level with available levels:

if logger.Level <= logger.INFO {
	log.Printf("Some log message")
}

if logger.Level <= logger.WARNING {
	log.Printf("Some log message")
}

Index

Constants

View Source
const (
	DEBUG = 1 << iota
	INFO
	WARNING
	ERROR
)

Available levels for logging

Variables

View Source
var Level int8 = INFO

Level hold the current log level

Functions

func SetLevel

func SetLevel(l int8)

SetLevel set the log level

Types

This section is empty.

Jump to

Keyboard shortcuts

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