log

package
v0.1.0-alpha Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2014 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuilderLogger

type BuilderLogger struct {
	Log
	Stderr io.Writer
	Stdout io.Writer
}

BuilderLogger is the implementation of the Log interface for this project.

func Initialize

func Initialize(quiet bool) *BuilderLogger

Initialize returns a BuilderLogger that either contains a null logger (that prints nothing) or a standard logger (from the log package) with project-specific output.

func (*BuilderLogger) Write

func (logger *BuilderLogger) Write(p []byte) (n int, err error)

type Log

type Log interface {
	Print(v ...interface{})
	Printf(format string, v ...interface{})
	Println(v ...interface{})
	Fatal(v ...interface{})
	Fatalf(format string, v ...interface{})
	Fatalln(v ...interface{})
	Panicf(format string, v ...interface{})
	Panicln(v ...interface{})
}

Log is the interface for all general logging methods.

type Logger

type Logger interface {
	Log
	Write(p []byte) (int, error)
}

Logger is almost identical to Log except that it also contains the Write(p []byte) method so it can satisfy tye io.Writer interface. At some point, these two types should probably be combined.

type NullLogger

type NullLogger struct{}

NullLogger is an exported symbol for the nullLogger struct.

func (*NullLogger) Fatal

func (nl *NullLogger) Fatal(v ...interface{})

Fatal fatals.

func (*NullLogger) Fatalf

func (nl *NullLogger) Fatalf(format string, v ...interface{})

Fatalf fatalfs.

func (*NullLogger) Fatalln

func (nl *NullLogger) Fatalln(v ...interface{})

Fatalln fatallns.

func (*NullLogger) Panicf

func (nl *NullLogger) Panicf(format string, v ...interface{})

Panicf panicfs.

func (*NullLogger) Panicln

func (nl *NullLogger) Panicln(v ...interface{})

Panicln paniclns.

func (*NullLogger) Print

func (nl *NullLogger) Print(v ...interface{})

Print prints.

func (*NullLogger) Printf

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

Printf printfs.

func (*NullLogger) Println

func (nl *NullLogger) Println(v ...interface{})

Println printlns.

func (*NullLogger) Write

func (nl *NullLogger) Write(p []byte) (int, error)

Write writes.

type OutWriter

type OutWriter struct {
	Log
	// contains filtered or unexported fields
}

An OutWriter is responsible for for implementing the io.Writer interface.

func NewOutWriter

func NewOutWriter(logger Log, fmtString string) *OutWriter

NewOutWriter accepts a logger and a format string and returns an OutWriter. When written to, the OutWriter will take the input, split it into lines, and print it to the logger using the provided format string. The intended use case of this functionality is for printing nice, colorful messages

func (*OutWriter) Write

func (ow *OutWriter) Write(p []byte) (n int, err error)

Write writes the provided bytes, one line at a time, after interpolating them into the provided format string, to the provided logger.

Jump to

Keyboard shortcuts

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