relog

package
v0.0.0-...-8e4f697 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2013 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

relog provides an alternate logger api with support for logging levels. Although flexible, the recommended usage is to create a logger object, set it as the global logger and use the package level functions to execute the logging. Multiple logger objects are only meant for those who like trouble.

Index

Constants

View Source
const (
	DEBUG = iota
	INFO
	WARNING
	ERROR
	LOG // Level to indicate line was output by the Go logging system.
	FATAL
)
View Source
const (
	Ltsv      = 1 << iota // guarantee a single line of tab-separated values
	Lblob                 // include JSON enoded annotations
	Lstdflags = 0
)

Variables

This section is empty.

Functions

func Debug

func Debug(format string, args ...interface{})

func Error

func Error(format string, args ...interface{})

func Fatal

func Fatal(format string, args ...interface{})

func HijackLog

func HijackLog(rl *Logger)

Place a shim in the default log package to route messages to a single file. If rl is nil, use the standard relog instance.

func HijackStdio

func HijackStdio(fOut *os.File, fErr *os.File) error

Replace stdout and stderr with a file. This overwrites the actual file descriptors which means even top level panic output will show up in these files.

func Info

func Info(format string, args ...interface{})

func LogNameToLogLevel

func LogNameToLogLevel(name string) (int, error)

func Redact

func Redact(s string) string

Redact returns a string of * having the same length as s.

func SetFlags

func SetFlags(flags int)

func SetLevel

func SetLevel(level int)

SetLevel sets the output level for the standard logger.

func SetLevelByName

func SetLevelByName(name string) error

func SetOutput

func SetOutput(w io.Writer)

SetOutput sets the output destination for the standard logger.

func SetPrefix

func SetPrefix(prefix string)

SetPrefix sets the output prefix for the standard logger.

func Warning

func Warning(format string, args ...interface{})

Types

type Logger

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

func New

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

func (*Logger) Debug

func (logger *Logger) Debug(format string, args ...interface{})

func (*Logger) Error

func (logger *Logger) Error(format string, args ...interface{})

func (*Logger) Fatal

func (logger *Logger) Fatal(format string, args ...interface{})

func (*Logger) Info

func (logger *Logger) Info(format string, args ...interface{})

func (*Logger) Prefix

func (logger *Logger) Prefix() string

func (*Logger) SetFlags

func (logger *Logger) SetFlags(flags int)

func (*Logger) SetLevel

func (logger *Logger) SetLevel(level int)

func (*Logger) SetPrefix

func (logger *Logger) SetPrefix(prefix string)

func (*Logger) Warning

func (logger *Logger) Warning(format string, args ...interface{})

type Redactor

type Redactor interface {
	// Redacted returns a copy of the instance with sensitive
	// information removed.
	Redacted() interface{}
}

Redactor is an interface for types that may contain sensitive information (like passwords), which shouldn't be printed to the log.

Jump to

Keyboard shortcuts

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