deferconsole

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2015 License: BSD-2-Clause Imports: 2 Imported by: 6

Documentation

Overview

Package deferconsole writes data with level filters and defer to stdout/stderr.

Index

Constants

View Source
const (
	// DstStdErr write to stderr
	DstStdErr = iota
	// DstStdOut write to stdout
	DstStdOut
)
View Source
const (
	// LevelKeep don't change level
	LevelKeep = -3
	// LevelSilence supress all output
	LevelSilence = -2
	// LevelRestore disable silence
	LevelRestore = -1
	// LevelSecret prints secrets
	LevelSecret = 0
	// LevelTrace prints traces
	LevelTrace = 1
	// LevelDebug for debugging information
	LevelDebug = 2
	// LevelInfo for general information
	LevelInfo = 3
	// LevelError to print errors
	LevelError = 4
	// LevelData is for data
	LevelData = 5
	// LevelPrint is for normal output
	LevelPrint = 6
	// LevelFatal for fatal erros
	LevelFatal = 7
)

Variables

View Source
var (
	// ToErrors  writes string to stderr
	ToErrors directFunc
	// ToError writes elements to error
	ToError stringFunc
	// ToErrorf writes formatted elements to error
	ToErrorf formatFunc
	// Prints writes string to stdout
	Prints directFunc
	// Printf writes formatted elements to stdout
	Printf formatFunc
	// Print writes elements to stdout
	Print stringFunc
	// Infos is info
	Infos directFunc
	// Info is info
	Info stringFunc
	// Infof is info
	Infof formatFunc
	// Debugs is debug
	Debugs directFunc
	// Debug is debug
	Debug stringFunc
	// Debugf is debug
	Debugf formatFunc
	// Errors is error
	Errors directFunc
	// Error is error
	Error stringFunc
	// Errorf is error
	Errorf formatFunc
	// Fatals is fatal
	Fatals directFunc
	// Fatal is fatal
	Fatal stringFunc
	// Fatalf is fatal
	Fatalf formatFunc
	// Traces is trace
	Traces directFunc
	// Trace is trace
	Trace stringFunc
	// Tracef is trace
	Tracef formatFunc
	// Secrets is secret
	Secrets directFunc
	// Secret is secret
	Secret stringFunc
	// Secretf is secret
	Secretf formatFunc
	// Datas is data
	Datas directFunc
	// Data is data
	Data stringFunc
	// Dataf is data
	Dataf formatFunc
)

Functions

func Replace

func Replace(c chan Message)

Replace the message channel to serve your own writer

func SetMinLevel

func SetMinLevel(level int)

SetMinLevel to level

func Silence

func Silence()

Silence all output

func Sync

func Sync()

Sync output (block until message(s) are processed)

func Voice

func Voice()

Voice output

Types

type Message

type Message struct {
	Level    int
	Content  string
	Dest     int
	Minlevel int
	Sync     chan bool
}

Message contains a message to write

Jump to

Keyboard shortcuts

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