log

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package log defines an interface that can be implemented in order to provide a logger for Harmony. A default implementation using Go's standard log package is also present.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Level

type Level int

Level defines the level from which log should be displayed.

const (
	// LevelDebug traces everything Harmony does, it dumps every HTTP call
	// and logs every websocket message. Very useful for debugging or developing
	// new features.
	// Beware of debug level as it is very chatty and it will log sensitive
	// information such as bot tokens, voice connections secret keys, etc.
	LevelDebug Level = 3
	// LevelInfo is here to notify that something happened. There's generally nothing to do
	// about them, they are just here to inform about an event.
	// This is also the default log level of Harmony.
	LevelInfo Level = 2
	// LevelWarn is for important logs that indicates something wrong or unusual happened.
	// The application is still running but probably in a degraded way and might crash if
	// no action is taken to fix the issues reported.
	LevelWarn Level = 1
	// LevelError is for when something went really wrong, meaning the connection to the
	// Gateway is probably down and/or failed to reconnect. These are very often network
	// issues.
	LevelError Level = 0
)

type Logger

type Logger interface {
	Debug(v ...interface{})
	Debugf(format string, v ...interface{})
	Info(v ...interface{})
	Infof(format string, v ...interface{})
	Warn(v ...interface{})
	Warnf(format string, v ...interface{})
	Error(v ...interface{})
	Errorf(format string, v ...interface{})

	Level() Level
}

Logger is the interface to implement in order to provide a logger compatible with Harmony.

func NewStd

func NewStd(w io.Writer, l Level) Logger

NewStd returns a new logger for Harmony based on the standard logger.

Jump to

Keyboard shortcuts

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