buflog

package
v0.0.0-...-61e6862 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2015 License: MIT Imports: 4 Imported by: 1

Documentation

Overview

Package buflog provides a buffered logging class that accumulates logs in memory until the flush threshold is reached which release stored logs, the buffered logger then act as a normal logger.

Basic example:

logger := buflog.New(os.Stdout, log.Info, log.Error)
logger.Info("Connecting to the server...")   // Outputs nothing
logger.Error("Connection failed")            // Outputs both lines

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger struct {
	*golog.Logger
	// contains filtered or unexported fields
}

A Logger represents an active buffered logging object.

func New

func New(out io.Writer, threshold log.Level, flushThreshold log.Level) *Logger

New creates a new Logger. The out variable sets the destination to which log data will be written. The threshold variable defines the level under which logging will be ignored. The flushThreshold variable defines the level above which logging will be output.

Jump to

Keyboard shortcuts

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