jot

package
v1.106.0 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package jot provides simple asynchronous logging.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug deprecated

func Debug(v ...any)

Debug logs a debugging message. Arguments are handled in the manner of fmt.Print.

Deprecated: Use slog instead. August 28, 2023

func Debugf deprecated

func Debugf(format string, v ...any)

Debugf logs a debugging message. Arguments are handled in the manner of fmt.Printf.

Deprecated: Use slog instead. August 28, 2023

func Error deprecated

func Error(v ...any)

Error logs an error message. Arguments are handled in the manner of fmt.Print.

Deprecated: Use slog instead. August 28, 2023

func Errorf deprecated

func Errorf(format string, v ...any)

Errorf logs an error message. Arguments are handled in the manner of fmt.Printf.

Deprecated: Use slog instead. August 28, 2023

func Fatal deprecated

func Fatal(status int, v ...any)

Fatal logs a fatal error message. Arguments other than the status are handled in the manner of fmt.Print.

Deprecated: Use slog instead. August 28, 2023

func FatalIfErr deprecated

func FatalIfErr(err error)

FatalIfErr calls 'Fatal(1, err)' if 'err' is not nil.

Deprecated: Use slog instead. August 28, 2023

func Fatalf deprecated

func Fatalf(status int, format string, v ...any)

Fatalf logs a fatal error message. Arguments other than the status are handled in the manner of fmt.Printf.

Deprecated: Use slog instead. August 28, 2023

func Flush deprecated

func Flush()

Flush waits for all current log entries to be written before returning.

Deprecated: Use slog instead. August 28, 2023

func Info deprecated

func Info(v ...any)

Info logs an informational message. Arguments are handled in the manner of fmt.Print.

Deprecated: Use slog instead. August 28, 2023

func Infof deprecated

func Infof(format string, v ...any)

Infof logs an informational message. Arguments are handled in the manner of fmt.Printf.

Deprecated: Use slog instead. August 28, 2023

func SetMinimumLevel deprecated

func SetMinimumLevel(level Level)

SetMinimumLevel sets the minimum log level that will be output. Default is DEBUG.

Deprecated: Use slog instead. August 28, 2023

func SetWriter deprecated

func SetWriter(w io.Writer)

SetWriter sets the io.Writer to use when writing log messages. Default is os.Stderr.

Deprecated: Use slog instead. August 28, 2023

func Time deprecated

func Time(v ...any) logadapter.Timing

Time starts timing an event and logs an informational message. Arguments are handled in the manner of fmt.Print.

Deprecated: Use slog instead. August 28, 2023

func Timef deprecated

func Timef(format string, v ...any) logadapter.Timing

Timef starts timing an event and logs an informational message. Arguments are handled in the manner of fmt.Printf.

Deprecated: Use slog instead. August 28, 2023

func Warn deprecated

func Warn(v ...any)

Warn logs a warning message. Arguments are handled in the manner of fmt.Print.

Deprecated: Use slog instead. August 28, 2023

func Warnf deprecated

func Warnf(format string, v ...any)

Warnf logs a warning message. Arguments are handled in the manner of fmt.Printf.

Deprecated: Use slog instead. August 28, 2023

Types

type Level deprecated

type Level int

Level holds a log level.

Deprecated: Use slog instead. August 28, 2023

const (
	DEBUG Level = iota
	INFO
	WARN
	ERROR
	FATAL
)

Log levels

type Logger deprecated

type Logger struct{}

Logger wraps the various jot function calls into a struct that can be passed around, typically for the sake of satisfying one or more logging interfaces.

Deprecated: Use slog instead. August 28, 2023

func (*Logger) Debug deprecated

func (lgr *Logger) Debug(v ...any)

Debug logs a debug message. Arguments are handled in the manner of fmt.Print.

Deprecated: Use slog instead. August 28, 2023

func (*Logger) Debugf deprecated

func (lgr *Logger) Debugf(format string, v ...any)

Debugf logs a debug message. Arguments are handled in the manner of fmt.Printf.

Deprecated: Use slog instead. August 28, 2023

func (*Logger) Error deprecated

func (lgr *Logger) Error(v ...any)

Error logs an error message. Arguments are handled in the manner of fmt.Print.

Deprecated: Use slog instead. August 28, 2023

func (*Logger) Errorf deprecated

func (lgr *Logger) Errorf(format string, v ...any)

Errorf logs an error message. Arguments are handled in the manner of fmt.Printf.

Deprecated: Use slog instead. August 28, 2023

func (*Logger) Fatal deprecated

func (lgr *Logger) Fatal(status int, v ...any)

Fatal logs a fatal error message. Arguments other than the status are handled in the manner of fmt.Print.

Deprecated: Use slog instead. August 28, 2023

func (*Logger) Fatalf deprecated

func (lgr *Logger) Fatalf(status int, format string, v ...any)

Fatalf logs a fatal error message. Arguments other than the status are handled in the manner of fmt.Printf.

Deprecated: Use slog instead. August 28, 2023

func (*Logger) Flush deprecated

func (lgr *Logger) Flush()

Flush waits for all current log entries to be written before returning.

Deprecated: Use slog instead. August 28, 2023

func (*Logger) Info deprecated

func (lgr *Logger) Info(v ...any)

Info logs an informational message. Arguments are handled in the manner of fmt.Print.

Deprecated: Use slog instead. August 28, 2023

func (*Logger) Infof deprecated

func (lgr *Logger) Infof(format string, v ...any)

Infof logs an informational message. Arguments are handled in the manner of fmt.Printf.

Deprecated: Use slog instead. August 28, 2023

func (*Logger) SetMinimumLevel deprecated

func (lgr *Logger) SetMinimumLevel(level Level)

SetMinimumLevel sets the minimum log level that will be output. Default is DEBUG.

Deprecated: Use slog instead. August 28, 2023

func (*Logger) SetWriter deprecated

func (lgr *Logger) SetWriter(w io.Writer)

SetWriter sets the io.Writer to use when writing log messages. Default is os.Stderr.

Deprecated: Use slog instead. August 28, 2023

func (*Logger) Time deprecated

func (lgr *Logger) Time(v ...any) logadapter.Timing

Time starts timing an event and logs an informational message. Arguments are handled in the manner of fmt.Print.

Deprecated: Use slog instead. August 28, 2023

func (*Logger) Timef deprecated

func (lgr *Logger) Timef(format string, v ...any) logadapter.Timing

Timef starts timing an event and logs an informational message. Arguments are handled in the manner of fmt.Printf.

Deprecated: Use slog instead. August 28, 2023

func (*Logger) Warn deprecated

func (lgr *Logger) Warn(v ...any)

Warn logs a warning message. Arguments are handled in the manner of fmt.Print.

Deprecated: Use slog instead. August 28, 2023

func (*Logger) Warnf deprecated

func (lgr *Logger) Warnf(format string, v ...any)

Warnf logs a warning message. Arguments are handled in the manner of fmt.Printf.

Deprecated: Use slog instead. August 28, 2023

func (*Logger) Write deprecated

func (lgr *Logger) Write(data []byte) (int, error)

Writer logs the data as an error after casting it to a string.

Deprecated: Use slog instead. August 28, 2023

type LoggerWriter deprecated

type LoggerWriter struct {
	Filter func(v ...any)
}

LoggerWriter provides a bridge between the standard log.Logger and the jot package. You can use it like this:

log.New(&jot.LoggerWriter{}, "", 0)

This will send all output for this logger to the jot.Error() call.

You can also set the Filter function to direct the output to a particular jot logging method:

log.New(&jot.LoggerWriter{Filter: jot.Info}), "", 0)

Deprecated: Use slog instead. August 28, 2023

func (*LoggerWriter) Write deprecated

func (w *LoggerWriter) Write(p []byte) (n int, err error)

Write implements the io.Writer interface required by log.Logger.

Deprecated: Use slog instead. August 28, 2023

Jump to

Keyboard shortcuts

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