log

package module
v1.1.23 Latest Latest
Warning

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

Go to latest
Published: May 19, 2020 License: Apache-2.0 Imports: 11 Imported by: 31

README

go-uatu

Go Client for uatu

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DEBUG log level
	DEBUG = Level{Text: "Debug", Severity: 0}
	// INFO log level
	INFO = Level{Text: "Info", Severity: 1}
	// WARNING log level
	WARNING = Level{Text: "Warning", Severity: 2}
	// ERROR log level
	ERROR = Level{Text: "Error", Severity: 3}
	// FATAL log level
	FATAL = Level{Text: "Fatal", Severity: 4}
)

Functions

This section is empty.

Types

type ILog

type ILog interface {
	Warnf(format string, v ...interface{})
	Warn(v ...interface{})
	Error(err error, v ...interface{})
	Errorf(err error, format string, v ...interface{})
	Fatal(err error, v ...interface{})
	Fatalf(err error, format string, v ...interface{})
	Debug(v ...interface{})
	Debugf(format string, v ...interface{})
	Print(v ...interface{})
	Printf(format string, v ...interface{})
	GetWriter(level Level) io.Writer
}

ILog interface

func Create

func Create(settings Settings) ILog

Create the logger

type Level

type Level struct {
	// Text representation of the log
	Text string
	// Severity value of the log
	Severity int
}

Level of the log

func GetLogLevel

func GetLogLevel(levelText string) Level

GetLogLevel gets the log level for input text

type Message

type Message struct {
	Text        string `json:"text"`
	Level       Level  `json:"level"`
	ServiceName string `json:"serviceName"`
	Time        int64  `json:"time"`
	Hostname    string `json:"hostname"`
}

Message to be sent to centralized logger

func (Message) String

func (message Message) String() string

type Settings

type Settings struct {
	ServiceName    string
	MinLogLevel    Level
	LogToConsole   bool
	UsePubSub      bool
	UseHTTP        bool
	HTTPSettings   publishers.HTTPSettings
	PubSubSettings pubsub.Settings
}

Settings for sending logs

type Writer

type Writer struct {
	Level Level
	// contains filtered or unexported fields
}

Writer for logs

func (Writer) Write

func (w Writer) Write(p []byte) (n int, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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