logger

package
v0.0.0-...-26bb5a1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package logger provides logging facilities for the NATS server

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSysLoggerTag

func GetSysLoggerTag() string

GetSysLoggerTag generates the tag name for use in syslog statements. If the executable is linked, the name of the link will be used as the tag, otherwise, the name of the executable is used. "nats-server" is the default for the NATS server.

func SetSyslogName

func SetSyslogName(name string)

SetSyslogName sets the name to use for the syslog. Currently used only on Windows.

Types

type LogOption

type LogOption interface {
	// contains filtered or unexported methods
}

type LogUTC

type LogUTC bool

LogUTC controls whether timestamps in the log output should be UTC or local time.

type Logger

type Logger struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Logger is the server logger

func NewFileLogger

func NewFileLogger(filename string, time, debug, trace, pid bool, opts ...LogOption) *Logger

NewFileLogger creates a logger with output directed to a file

func NewStdLogger

func NewStdLogger(time, debug, trace, colors, pid bool, opts ...LogOption) *Logger

NewStdLogger creates a logger with output directed to Stderr

func NewTestLogger

func NewTestLogger(prefix string, time bool) *Logger

NewTestLogger creates a logger with output directed to Stderr with a prefix. Useful for tracing in tests when multiple servers are in the same pid

func (*Logger) Close

func (l *Logger) Close() error

Close implements the io.Closer interface to clean up resources in the server's logger implementation. Caller must ensure threadsafety.

func (*Logger) Debugf

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

Debugf logs a debug statement

func (*Logger) Errorf

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

Errorf logs an error statement

func (*Logger) Fatalf

func (l *Logger) Fatalf(format string, v ...interface{})

Fatalf logs a fatal error

func (*Logger) Noticef

func (l *Logger) Noticef(format string, v ...interface{})

Noticef logs a notice statement

func (*Logger) SetMaxNumFiles

func (l *Logger) SetMaxNumFiles(max int) error

SetMaxNumFiles sets the number of archived log files that will be retained

func (*Logger) SetSizeLimit

func (l *Logger) SetSizeLimit(limit int64) error

SetSizeLimit sets the size of a logfile after which a backup is created with the file name + "year.month.day.hour.min.sec.nanosec" and the current log is truncated.

func (*Logger) Tracef

func (l *Logger) Tracef(format string, v ...interface{})

Tracef logs a trace statement

func (*Logger) Warnf

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

Warnf logs a notice statement

type SysLogger

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

SysLogger provides a system logger facility

func NewRemoteSysLogger

func NewRemoteSysLogger(fqn string, debug, trace bool) *SysLogger

NewRemoteSysLogger creates a new remote system logger

func NewSysLogger

func NewSysLogger(debug, trace bool) *SysLogger

NewSysLogger creates a new system logger

func (*SysLogger) Debugf

func (l *SysLogger) Debugf(format string, v ...interface{})

Debugf logs a debug statement

func (*SysLogger) Errorf

func (l *SysLogger) Errorf(format string, v ...interface{})

Errorf logs an error statement

func (*SysLogger) Fatalf

func (l *SysLogger) Fatalf(format string, v ...interface{})

Fatalf logs a fatal error

func (*SysLogger) Noticef

func (l *SysLogger) Noticef(format string, v ...interface{})

Noticef logs a notice statement

func (*SysLogger) Tracef

func (l *SysLogger) Tracef(format string, v ...interface{})

Tracef logs a trace statement

func (*SysLogger) Warnf

func (l *SysLogger) Warnf(format string, v ...interface{})

Warnf logs a warning statement

Jump to

Keyboard shortcuts

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