logger

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2019 License: MIT Imports: 5 Imported by: 2

Documentation

Overview

Package logger contains an interface for loggers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSONLogger

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

JSONLogger is an implemtation of Logger interface. Makes logs in json format.

func (JSONLogger) Fatal

func (jl JSONLogger) Fatal(v ...interface{})

Fatal prints log record in json format and then makes os.Exit(1).

func (JSONLogger) Fatalf

func (jl JSONLogger) Fatalf(format string, a ...interface{})

Fatalf prints log record in json format with formatted message and then makes os.Exit(1).

func (JSONLogger) Fatalln

func (jl JSONLogger) Fatalln(v ...interface{})

Fatalln prints log record in json format with new line and then makes os.Exit(1).

func (JSONLogger) GetLevel

func (jl JSONLogger) GetLevel() string

GetLevel returns level of logging.

func (JSONLogger) GetStream

func (jl JSONLogger) GetStream() io.Writer

GetStream returns logging output stream.

func (JSONLogger) Panic

func (jl JSONLogger) Panic(v ...interface{})

Panic prints log record in json format and then panics.

func (JSONLogger) Panicf

func (jl JSONLogger) Panicf(format string, a ...interface{})

Panicf prints log record in json format with formatted message and the panics.

func (JSONLogger) Panicln

func (jl JSONLogger) Panicln(v ...interface{})

Panicln prints log record in json format with new line and then panics.

func (JSONLogger) Print

func (jl JSONLogger) Print(v ...interface{})

Print prints log record in json format.

func (JSONLogger) Printf

func (jl JSONLogger) Printf(format string, a ...interface{})

Printf print log record in json format with formatted message.

func (JSONLogger) Println

func (jl JSONLogger) Println(v ...interface{})

Println prints log record in json format with new line.

func (*JSONLogger) SetLevel

func (jl *JSONLogger) SetLevel(level string)

SetLevel sets level of logging.

func (*JSONLogger) SetStream

func (jl *JSONLogger) SetStream(stream io.Writer)

SetStream sets logging output stream.

type Logger

type Logger interface {
	// SetLevel sets level of logging.
	SetLevel(string)

	// GetLevel returns level of logging.
	GetLevel() string

	// SetStream sets logging output stream.
	SetStream(io.Writer)

	// GetStream returns logging output stream.
	GetStream() io.Writer

	// Print prints log record.
	Print(...interface{})

	// Println prints log record with new line.
	Println(...interface{})

	// Printf print log record with formatted message.
	Printf(string, ...interface{})

	// Panic prints log record and then panics.
	Panic(...interface{})

	// Panicln prints log record with new line and then panics.
	Panicln(...interface{})

	// Panicf prints log record with formatted message and the panics.
	Panicf(string, ...interface{})

	// Fatal prints log record and then makes os.Exit(1).
	Fatal(...interface{})

	// Fatalln prints log record with new line and then makes os.Exit(1).
	Fatalln(...interface{})

	// Fatalf prints log record with formatted message and then makes os.Exit(1).
	Fatalf(string, ...interface{})
}

Logger is an interface for loggers.

Jump to

Keyboard shortcuts

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