logger

package
v0.0.0-...-31f5ead Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EMERGENCY level - system is unusable
	EMERGENCY int = iota
	// ALERT level - action must be taken immediately
	ALERT
	// CRITICAL level - critical conditions
	CRITICAL
	// ERROR level - error conditions
	ERROR
	// WARNING level - warning conditions
	WARNING
	// NOTICE level - normal, but significant, condition
	NOTICE
	// INFO level - informational message
	INFO
	// DEBUG level
	DEBUG
)

Variables

View Source
var (
	// DefaultParams that will be send to graylog
	DefaultParams = map[string]interface{}{}
	// GraylogHost env var
	GraylogHost = ""
	// GraylogPort env var
	GraylogPort = ""
)

Functions

This section is empty.

Types

type Graylog

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

Graylog logger

func New

func New(serviceName string) *Graylog

New graylog logger

func (*Graylog) CreateMessage

func (g *Graylog) CreateMessage(message string) *Message

CreateMessage for graylog

func (*Graylog) Send

func (g *Graylog) Send(level int, m string)

Send message to graylog

type Logger

type Logger interface {
	CreateMessage(message string) *Message
	Send(int, string)
}

Logger interface

type Message

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

Message object

func (*Message) Send

func (m *Message) Send()

Send message

func (*Message) SetCode

func (m *Message) SetCode(code string) *Message

SetCode for error

func (*Message) SetID

func (m *Message) SetID(id string) *Message

SetID for message

func (*Message) SetLevel

func (m *Message) SetLevel(level int) *Message

SetLevel for message

func (*Message) SetLineOfCode

func (message *Message) SetLineOfCode(code oerror.LineOfCode) *Message

func (*Message) SetMap

func (m *Message) SetMap(p map[string]interface{}) *Message

SetMap will loop through the map and will add each entry as top level key for the message

func (*Message) SetParams

func (m *Message) SetParams(p interface{}) *Message

SetParams for message

func (*Message) ShouldSkip

func (m *Message) ShouldSkip() bool

ShouldSkip checks the log level and do not log the messag if the level is too low

Jump to

Keyboard shortcuts

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