golog

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: Unlicense Imports: 11 Imported by: 0

README

Golog

Minimal overhead leveled logging routines for golang.

Introduction

Wraps log into a higher level abstraction that handles the following:

  • Log levels
  • File output
  • Syslog output
  • Performance timings

The goals of Golog are to get as close as possible to zero overhead, while allowing fine grained control of logging.

Dependencies

This package has no external dependencies.

Installation

go get github/mlavergn/golog

Examples

import . "golog"

SetLogLevel(LOG_ALL)
LogDebug("debug")
LogInfo("info")
LogWarn("warning")
LogError("error")

LogConfigure(LOG_WARN, LOG_STDOUT)
LogDebug("debug")
LogInfo("info")
LogWarn("warning")
LogError("error")

Documentation

Index

Constants

View Source
const (
	LOG_ALL = iota
	LOG_DEBUG
	LOG_INFO
	LOG_WARN
	LOG_ERROR
	LOG_FATAL
	LOG_OFF
)

Log levels

View Source
const (
	LOG_STDOUT = iota
	LOG_STDERR
	LOG_FILE
	LOG_SYSTEM
)

Log destinations

Variables

View Source
var LogDebug _output = _DevNull

LogDebug accepts a value, outputting when LOG_LEVEL <= LOG_DEBUG

View Source
var LogDebugf _outputf = _DevNullf

LogDebugf accepts a format mask and a value, outputting when LOG_LEVEL <= LOG_DEBUG

View Source
var LogError _output = _Output

LogError accepts a value, outputting when LOG_LEVEL <= LOG_ERROR

View Source
var LogErrorf _outputf = _Outputf

LogErrorf accepts a format mask and a value, outputting when LOG_LEVEL <= LOG_ERROR

View Source
var LogFatal _output = _OutputExit

LogFatal accepts a value, outputting when LOG_LEVEL <= LOG_FATAL, then exitting

View Source
var LogFatalf _outputf = _OutputExitf

LogFatalf accepts a format mask and a value, outputting when LOG_LEVEL <= LOG_FATAL, then exitting

View Source
var LogInfo _output = _Output

LogInfo accepts a value, outputting when LOG_LEVEL <= LOG_INFO

View Source
var LogInfof _outputf = _Outputf

LogInfof accepts a format mask and a value, outputting when LOG_LEVEL <= LOG_INFO

View Source
var LogWarn _output = _Output

LogWarn accepts a value, outputting when LOG_LEVEL <= LOG_WARN

View Source
var LogWarnf _outputf = _Outputf

LogWarnf accepts a format mask and a value, outputting when LOG_LEVEL <= LOG_WARN

Functions

func LogConfigure

func LogConfigure(level int, dest int)

logConfigOutput configures the logger.

func LogDumpFile

func LogDumpFile(modulename string, output string)

Dump to file

func SetLogLevel

func SetLogLevel(level int)

Modify the log level. The default log level is LOG_WARN.

func TimerMark

func TimerMark()

TimerMark marks the beginning of a timing period

func TimerMeasure

func TimerMeasure()

TimerMeasure outputs at level LOG_DEBUG the elapsed time since the last call to TimerMark

Types

This section is empty.

Jump to

Keyboard shortcuts

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