log

package module
v0.0.0-...-775874b Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2016 License: MIT Imports: 2 Imported by: 38

README

GoDoc

Package log provides a simple wrapper around the standard Go library's log package, combining concepts from two of Dave Cheney's blog posts:

In particular, it exposes only the log.Print* functions, and adds an additional set of log.Debug* functions, which in turn call their log.Print* counterparts only when the 'debug' build tag is present.

This package is released under the terms of the MIT license. See the included LICENSE.txt for details.

Documentation

Overview

Package log provides a simple wrapper around the standard Go library's 'log' package, combining concepts from two of Dave Cheney's blog posts:

In particular, it exposes only the log.Print* functions, and adds an additional set of log.Debug* functions, which in turn call their log.Print* counterparts only when the 'debug' build tag is present.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(v ...interface{})

Debug calls log.Print() only when the 'debug' build flag is present.

func Debugf

func Debugf(format string, v ...interface{})

Debugf calls log.Printf() only when the 'debug' build flag is present.

func Debugln

func Debugln(v ...interface{})

Debugln calls log.Println() only when the 'debug' build flag is present.

func Flags

func Flags() int

Flags returns the output flags for the standard logger.

func Print

func Print(v ...interface{})

Print calls log.Print()

func Printf

func Printf(format string, v ...interface{})

Printf calls log.Printf()

func Println

func Println(v ...interface{})

Println calls log.Println()

Types

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

A Logger represents an active logging object that generates lines of output to an io.Writer. Each logging operation makes a single call to the Writer's Write method. A Logger can be used simultaneously from multiple goroutines; it guarantees to serialize access to the Writer.

func New

func New(out io.Writer, prefix string, flag int) *Logger

New creates a new Logger.

func (*Logger) Debug

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

Debug calls log.Print() only when the 'debug' build flag is present.

func (*Logger) Debugf

func (l *Logger) Debugf(format string, v ...interface{})

Debugf calls log.Printf() only when the 'debug' build flag is present.

func (*Logger) Debugln

func (l *Logger) Debugln(v ...interface{})

Debugln calls log.Println() only when the 'debug' build flag is present.

func (*Logger) Flags

func (l *Logger) Flags() int

Flags returns the output flags for the logger.

func (*Logger) Print

func (l *Logger) Print(v ...interface{})

Print calls log.Print()

func (*Logger) Printf

func (l *Logger) Printf(format string, v ...interface{})

Printf calls log.Printf()

func (*Logger) Println

func (l *Logger) Println(v ...interface{})

Println calls log.Println()

Jump to

Keyboard shortcuts

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