log

package module
v0.0.0-...-7bfeada Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2017 License: BSD-3-Clause Imports: 5 Imported by: 0

README

log

Package log implements a simple logger.

Register writers (such as files, pipes, etc) using RegWriter and start logging. If no writers are registered Log writes everything to os.Stdout.

Documentation

Overview

Implements a simple logger. Register writers (such as files, pipes, etc) using RegWriter and start logging. If no writers are registered Log writes everything to os.Stdout.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(f string, v ...interface{})

Format v to f and Log it. Logs if LogLevel >= 4.

func Error

func Error(f string, e error, v ...interface{})

Errorf logs then returns error e prefixed with v formatted to f. Logs if LogLevel >= 1.

func Info

func Info(f string, v ...interface{})

Format v to f and Log it. Logs if LogLevel >= 3.

func Log

func Log(f string, v ...interface{})

Format v with f and log it.

func Warning

func Warning(f string, v ...interface{})

Format v to f and log it. Logs if LogLevel >= 2.

Types

type Logger

type Logger struct {
	LogLevel int // (0 .. 4) = (no logging, error, warning, info, debug)
	// contains filtered or unexported fields
}

Logger

func DefaultLog

func DefaultLog() *Logger

Returns default logger for tweaking.

func NewLog

func NewLog(loglevel int) *Logger

Creates a new log.

func (*Logger) Debug

func (l *Logger) Debug(f string, v ...interface{})

Format v to f and Log it. Logs if LogLevel >= 4.

func (*Logger) Error

func (l *Logger) Error(f string, e error, v ...interface{}) error

Errorf logs then returns error e prefixed with v formatted to f. Logs if LogLevel >= 1.

func (*Logger) Info

func (l *Logger) Info(f string, v ...interface{})

Format v to f and Log it. Logs if LogLevel >= 3.

func (*Logger) Log

func (l *Logger) Log(f string, v ...interface{})

Format v with f and log it.

func (*Logger) RegWriter

func (l *Logger) RegWriter(name string, w io.Writer)

Register a valid io.Writer by name. Caller is responsible for writer. Name is used solely if caller wishes to UnregWriter() later on.

func (*Logger) UnregWriter

func (l *Logger) UnregWriter(name string)

Unregisters a writer by name.

func (*Logger) Warning

func (l *Logger) Warning(f string, v ...interface{})

Format v to f and log it. Logs if LogLevel >= 2.

Jump to

Keyboard shortcuts

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