hqgologger

package module
v0.0.0-...-a7d1203 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2022 License: MIT Imports: 9 Imported by: 0

README

hqgologger

A Go (Golang) package for logging.

Installation

go get github.com/hueristiq/hqgologger

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

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

Event is a log event to be written with data

func Debug

func Debug() (event *Event)

Debug writes an error message on the screen with the default label

func Error

func Error() (event *Event)

Error writes a error message on the screen with the default label

func Fatal

func Fatal() (event *Event)

Fatal exits the program if we encounter a fatal error

func Info

func Info() (event *Event)

Info writes a info message on the screen with the default label

func Print

func Print() (event *Event)

Print prints a string on screen without any extra labels.

func Warning

func Warning() (event *Event)

Warning writes a warning message on the screen with the default label

func (*Event) Label

func (event *Event) Label(label string) *Event

Label applies a custom label on the log event

func (*Event) Msg

func (event *Event) Msg(message string)

Msg logs a message to the logger

func (*Event) Msgf

func (event *Event) Msgf(format string, args ...interface{})

Msgf logs a printf style message to the logger

func (*Event) Rest

func (event *Event) Rest(character string) *Event

Rest applies a custom label on the log event

type Logger

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

Logger is the logger for logging structured data.

var (
	DefaultLogger *Logger
)

func (*Logger) Debug

func (logger *Logger) Debug() *Event

Debug writes an error message on the screen with the default label

func (*Logger) Error

func (logger *Logger) Error() *Event

Error writes a error message on the screen with the default label

func (*Logger) Fatal

func (logger *Logger) Fatal() *Event

Fatal exits the program if we encounter a fatal error

func (*Logger) Info

func (logger *Logger) Info() *Event

Info writes a info message on the screen with the default label

func (*Logger) Log

func (logger *Logger) Log(event *Event)

Log logs an Event

func (*Logger) Print

func (logger *Logger) Print() *Event

Print prints a string on screen without any extra labels.

func (*Logger) SetFormatter

func (logger *Logger) SetFormatter(formatter formatter.Formatter)

SetFormatter sets the Logger's formatter

func (*Logger) SetMaxLevel

func (logger *Logger) SetMaxLevel(level levels.LevelStr)

SetMaxLevel sets the Logger's max logging level

func (*Logger) SetWriter

func (logger *Logger) SetWriter(writer writer.Writer)

SetWriter sets the Logger's writer

func (*Logger) Warning

func (logger *Logger) Warning() *Event

Warning writes a warning message on the screen with the default label

type Streamer

type Streamer struct {
	Logger *Logger
	// contains filtered or unexported fields
}

func NewLogstreamer

func NewLogstreamer(logger *Logger, prefix string, record bool) *Streamer

func (*Streamer) Close

func (l *Streamer) Close() error

func (*Streamer) Flush

func (l *Streamer) Flush() error

func (*Streamer) FlushRecord

func (l *Streamer) FlushRecord() string

func (*Streamer) OutputLines

func (l *Streamer) OutputLines() error

func (*Streamer) Write

func (l *Streamer) 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