Documentation
¶
Index ¶
- type Level
- type Log
- type LogWriter
- type LogWriterFlags
- type LogWriterGCP
- type LogWriterStandard
- type LogWriterTest
- type PrefixLogger
- func (l *PrefixLogger) Close()
- func (l *PrefixLogger) Criticalf(format string, a ...any)
- func (l *PrefixLogger) Debugf(format string, a ...any)
- func (l *PrefixLogger) Errorf(format string, a ...any)
- func (l *PrefixLogger) Infof(format string, a ...any)
- func (l *PrefixLogger) Warnf(format string, a ...any)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Level ¶
type Level int
Log level
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 LogWriter ¶
type LogWriter interface {
Flags() LogWriterFlags
Write(level Level, message string)
Close()
}
LogWriter is the low level object that writes the logs
type LogWriterFlags ¶
type LogWriterFlags int
Log writer flags
const ( LogWriterFlagNeedNewline LogWriterFlags = 1 << iota // If you should end the message with a \n LogWriterFlagWantDate // If you should embed the date at the start of the message LogWriterFlagWantLevel // If you should embed the level at the start of the message LogWriterFlagWantColors // If you should embed color escape codes )
type LogWriterGCP ¶
Write logs to Google Cloud
func (*LogWriterGCP) Close ¶
func (w *LogWriterGCP) Close()
func (*LogWriterGCP) Flags ¶
func (w *LogWriterGCP) Flags() LogWriterFlags
func (*LogWriterGCP) Write ¶
func (w *LogWriterGCP) Write(level Level, message string)
type LogWriterStandard ¶
Write logs to a standard file such as stdout
func (*LogWriterStandard) Close ¶
func (w *LogWriterStandard) Close()
func (*LogWriterStandard) Flags ¶
func (w *LogWriterStandard) Flags() LogWriterFlags
func (*LogWriterStandard) Write ¶
func (w *LogWriterStandard) Write(level Level, message string)
type LogWriterTest ¶
Write logs during unit tests
func (*LogWriterTest) Close ¶
func (w *LogWriterTest) Close()
func (*LogWriterTest) Flags ¶
func (w *LogWriterTest) Flags() LogWriterFlags
func (*LogWriterTest) Write ¶
func (w *LogWriterTest) Write(level Level, message string)
type PrefixLogger ¶
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 ...any)
func (*PrefixLogger) Debugf ¶
func (l *PrefixLogger) Debugf(format string, a ...any)
func (*PrefixLogger) Errorf ¶
func (l *PrefixLogger) Errorf(format string, a ...any)
func (*PrefixLogger) Infof ¶
func (l *PrefixLogger) Infof(format string, a ...any)
func (*PrefixLogger) Warnf ¶
func (l *PrefixLogger) Warnf(format string, a ...any)
Click to show internal directories.
Click to hide internal directories.