logs

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: MIT Imports: 7 Imported by: 25

README

Logs

This is the logging package used by the Cyclops camera system.

These are plain old textual logs, with a logging level and a format string.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Level

type Level int
const (
	LevelDebug    Level = iota // information that only a programmer will understand
	LevelInfo                  // information that a non-programmer might be interested in
	LevelWarn                  // speeds up tracking down issues, once you know about them
	LevelError                 // should not have happened
	LevelCritical              // wake somebody up
)

type Log

type Log interface {
	Close() // Give logger a chance to flush
	Debugf(format string, a ...interface{})
	Infof(format string, a ...interface{})
	Warnf(format string, a ...interface{})
	Errorf(format string, a ...interface{})
	Criticalf(format string, a ...interface{})
}

func NewLog

func NewLog() (Log, error)

func NewTestingLog

func NewTestingLog(t *testing.T) Log

type Logger

type Logger struct {
	Output       io.Writer
	GCP          *logging.Logger
	Client       *logging.Client
	EnableColors bool
}

func (*Logger) Close

func (l *Logger) Close()

func (*Logger) Criticalf

func (l *Logger) Criticalf(format string, a ...interface{})

func (*Logger) Debugf

func (l *Logger) Debugf(format string, a ...interface{})

func (*Logger) Errorf

func (l *Logger) Errorf(format string, a ...interface{})

func (*Logger) Infof

func (l *Logger) Infof(format string, a ...interface{})

func (*Logger) Warnf

func (l *Logger) Warnf(format string, a ...interface{})

type PrefixLogger

type PrefixLogger struct {
	Log    Log
	Prefix string
}

PrefixLogger writes to the underlying log, but all messages are prefixed with a string of your choice

func NewPrefixLogger

func NewPrefixLogger(log Log, prefix string) *PrefixLogger

Create a new PrefixLogger

func NewPrefixLoggerNoSpace

func NewPrefixLoggerNoSpace(log Log, prefix string) *PrefixLogger

Create a new PrefixLogger, but don't add a space onto 'prefix'

func (*PrefixLogger) Close

func (l *PrefixLogger) Close()

func (*PrefixLogger) Criticalf

func (l *PrefixLogger) Criticalf(format string, a ...interface{})

func (*PrefixLogger) Debugf

func (l *PrefixLogger) Debugf(format string, a ...interface{})

func (*PrefixLogger) Errorf

func (l *PrefixLogger) Errorf(format string, a ...interface{})

func (*PrefixLogger) Infof

func (l *PrefixLogger) Infof(format string, a ...interface{})

func (*PrefixLogger) Warnf

func (l *PrefixLogger) Warnf(format string, a ...interface{})

Jump to

Keyboard shortcuts

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