logs

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: May 19, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cooler

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

Cooler allows you to save/get if something is already running or not (active).

func (*Cooler) Active

func (c *Cooler) Active() bool

Active returns true if a cooler already active. Returns false if not, and activates the cooler.

func (*Cooler) Done

func (c *Cooler) Done()

Done resets a cooler.

type Logger

type Logger struct {
	ErrorLog *log.Logger // Shares a Writer with Logger.
	DebugLog *log.Logger // Shares a Writer with Logger.
	InfoLog  *log.Logger
	HTTPLog  *log.Logger
	// contains filtered or unexported fields
}

Logger provides some methods with baked in assumptions.

func New

func New() *Logger

New returns a new Logger with debug off and sends everything to stdout.

func (*Logger) Debug

func (l *Logger) Debug(v ...interface{})

Debug writes log lines... to stdout and/or a file.

func (*Logger) Debugf

func (l *Logger) Debugf(msg string, v ...interface{})

Debugf writes log lines... to stdout and/or a file.

func (*Logger) Error

func (l *Logger) Error(v ...interface{})

Error writes log lines... to stdout and/or a file.

func (*Logger) Errorf

func (l *Logger) Errorf(msg string, v ...interface{})

Errorf writes log lines... to stdout and/or a file.

func (*Logger) Print

func (l *Logger) Print(v ...interface{})

Print writes log lines... to stdout and/or a file.

func (*Logger) Printf

func (l *Logger) Printf(msg string, v ...interface{})

Printf writes log lines... to stdout and/or a file.

func (*Logger) Rotate

func (l *Logger) Rotate() (errors []error)

Rotate rotates the log files.

func (*Logger) SetupLogging

func (l *Logger) SetupLogging(config *Logs)

SetupLogging splits log writers into a file and/or stdout.

type Logs

type Logs struct {
	AppName   string `json:"-"`
	LogFile   string `json:"log_file" toml:"log_file" xml:"log_file" yaml:"log_file"`
	HTTPLog   string `json:"http_log" toml:"http_log" xml:"http_log" yaml:"http_log"`
	LogFiles  int    `json:"log_files" toml:"log_files" xml:"log_files" yaml:"log_files"`
	LogFileMb int    `json:"log_file_mb" toml:"log_file_mb" xml:"log_file_mb" yaml:"log_file_mb"`
	Debug     bool   `json:"debug" toml:"debug" xml:"debug" yaml:"debug"`
	Quiet     bool   `json:"quiet" toml:"quiet" xml:"quiet" yaml:"quiet"`
}

Logs allows sending logs to rotating files. Setting an AppName will force log creation even if LogFile and HTTPLog are empty.

type Timer

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

func (*Timer) Active

func (t *Timer) Active(d time.Duration) bool

Jump to

Keyboard shortcuts

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