Documentation
¶
Overview ¶
Package log is a replacement for the standard log package based on slog. This should not be used unless writing debug statements. Most logging happens at the service level packages. Choose tracing over logging for production debugging.
Index ¶
- Variables
- func Default() *slog.Logger
- func Fatal(v ...any)
- func Fatalf(format string, v ...any)
- func Fatalln(v ...any)
- func Flags() int
- func Panic(v ...any)
- func Panicf(format string, v ...any)
- func Panicln(v ...any)
- func Prefix() string
- func Print(v ...any)
- func Printf(format string, v ...any)
- func Println(v ...any)
- func Set(l *slog.Logger)
- func SetFlags(flag int)
Constants ¶
This section is empty.
Variables ¶
var LogLevel = new(slog.LevelVar) // Info by default
LogLevel is the log level for the program. This is used to set the log level for the program. This is automatically set for the default logger unless .Set() is used to switch out that logger. If the new logger is created from the adapter package, it uses this LogLevel. If not, you must pass this to your logger manually.
Functions ¶
func Default ¶
Default returns the default logger. This logger should only be used outside main() and the gRPC service level if there is code running in a goroutine outside the request handling that needs to log messages or you need to pass the logger to a function outside of medbay. Anything other use of this logger (or any logger) is verboten.
func Fatal ¶
func Fatal(v ...any)
Fatal is equivalent to Print followed by a call to os.Exit(1). If called in production, it will panic instead of exiting.
func Fatalf ¶
Fatalf is equivalent to Printf followed by a call to os.Exit(1). If called in production, it will panic instead of exiting.
func Fatalln ¶
func Fatalln(v ...any)
Fatalln is equivalent to Println followed by a call to os.Exit(1). If called in production, it will panic instead of exiting.
func Flags ¶
func Flags() int
Flags returns the output flags for the standard logger. The flag bits are [Ldate], [Ltime], and so on.
func Panicln ¶
func Panicln(v ...any)
Panicln is equivalent to Println followed by a call to panic().
func Print ¶
func Print(v ...any)
Print calls Output to print to the standard logger. Arguments are handled in the manner of fmt.Print.
func Printf ¶
Printf calls Output to print to the standard logger. Arguments are handled in the manner of fmt.Printf.
func Println ¶
func Println(v ...any)
Println calls Output to print to the standard logger. Arguments are handled in the manner of fmt.Println.
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package adapters provides adapters for converting logging instances to the *slog.Logger type.
|
Package adapters provides adapters for converting logging instances to the *slog.Logger type. |
|
utils
|
|
|
debugstrip
command
Package debugstrip provides a utility to reformat JSON log lines into a more human-readable format.
|
Package debugstrip provides a utility to reformat JSON log lines into a more human-readable format. |