nilog

package module
v1.0.1-0...-91d4711 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2020 License: BSD-3-Clause Imports: 4 Imported by: 1

README

PkgGoDev

nilog

A wrapping/modification of Go's standard log library that allows for (*Logger)(nil).

Documentation

Overview

Package nilog provides a wrapper for log.Logger, making a nil value a no-op.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger log.Logger

Logger wraps log.Logger, making a nil value a no-op.

func New

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

New wraps log.New into a *Logger.

func (*Logger) Fatal

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

Fatal is equivalent to l.Print() followed by a call to os.Exit(1).

func (*Logger) Fatalf

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

Fatalf is equivalent to l.Printf() followed by a call to os.Exit(1).

func (*Logger) Fatalln

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

Fatalln is equivalent to l.Println() followed by a call to os.Exit(1).

func (*Logger) Flags

func (l *Logger) Flags() int

Flags wraps (*log.Logger)(l).Flags, returning -1 if l is nil.

func (*Logger) Output

func (l *Logger) Output(calldepth int, s string) error

Output wraps (*log.Logger)(l).Output, returning early if l is nil, and incrementing the calldepth by 1.

func (*Logger) Panic

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

Panic is equivalent to l.Print() followed by a call to panic().

func (*Logger) Panicf

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

Panicf is equivalent to l.Printf() followed by a call to panic().

func (*Logger) Panicln

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

Panicln is equivalent to l.Println() followed by a call to panic().

func (*Logger) Prefix

func (l *Logger) Prefix() string

Prefix wraps (*log.Logger)(l).Prefix, returning "" if l is nil.

func (*Logger) Print

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

Print calls l.Output to print to the logger. Arguments are handled in the manner of fmt.Print.

func (*Logger) Printf

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

Printf calls l.Output to print to the logger. Arguments are handled in the manner of fmt.Printf.

func (*Logger) Println

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

Println calls l.Output to print to the logger. Arguments are handled in the manner of fmt.Println.

func (*Logger) SetFlags

func (l *Logger) SetFlags(flag int)

SetFlags wraps (*log.Logger)(l).SetFlags, returning early if l is nil.

func (*Logger) SetOutput

func (l *Logger) SetOutput(w io.Writer)

SetOutput wraps (*log.Logger)(l).SetOutput, returning early if l is nil.

func (*Logger) SetPrefix

func (l *Logger) SetPrefix(prefix string)

SetPrefix wraps (*log.Logger)(l).SetPrefix, returning early if l is nil.

func (*Logger) Writer

func (l *Logger) Writer() io.Writer

Writer wraps (*log.Logger)(l).Writer, returning nil if l is nil.

Jump to

Keyboard shortcuts

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