Documentation
¶
Index ¶
- func GetIPAddresses() (ipv4 string, ipv6 string)
- func GetLocation() string
- type ConsoleLogger
- type ConsoleTransport
- type FileLogger
- type FileTransport
- type ITransport
- type Level
- type LogData
- type Logger
- type LoggerCore
- func (l *LoggerCore) AddTransport(name string, transport ITransport)
- func (l *LoggerCore) Close()
- func (l *LoggerCore) CloseAllTransport()
- func (l *LoggerCore) CloseTransport(name string)
- func (l *LoggerCore) Debug(format string, v ...interface{})
- func (l *LoggerCore) DisableTransport(name string)
- func (l *LoggerCore) EnableTransport(name string)
- func (l *LoggerCore) Error(format string, v ...interface{})
- func (l *LoggerCore) Fatal(format string, v ...interface{})
- func (l *LoggerCore) Flush()
- func (l *LoggerCore) FlushSync()
- func (l *LoggerCore) GetTransport(name string) ITransport
- func (l *LoggerCore) Info(format string, v ...interface{})
- func (l *LoggerCore) Log(level Level, format string, v ...interface{})
- func (l *LoggerCore) ReloadAllTransports()
- func (l *LoggerCore) ReloadTransport(name string)
- func (l *LoggerCore) RemoveTransport(name string)
- func (l *LoggerCore) Trace(format string, v ...interface{})
- func (l *LoggerCore) Warn(format string, v ...interface{})
- type LoggerOptions
- type Transport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetIPAddresses ¶
GetIPAddresses This function returns the IP addresses of the current machine.
func GetLocation ¶
func GetLocation() string
GetLocation returns the file name and line number of the caller of the method that called
Types ¶
type ConsoleLogger ¶
type ConsoleLogger struct {
*LoggerCore
}
func NewConsoleLogger ¶
func NewConsoleLogger(name string, level Level) *ConsoleLogger
type ConsoleTransport ¶
type ConsoleTransport struct {
*Transport
}
func NewConsoleTransport ¶
func NewConsoleTransport(name string, level Level) *ConsoleTransport
func (*ConsoleTransport) Log ¶
func (c *ConsoleTransport) Log(formattedData string, _ *LogData)
type FileLogger ¶
type FileLogger struct {
*LoggerCore
}
func NewFileLogger ¶
func NewFileLogger(name string, level Level, filepath string) *FileLogger
type FileTransport ¶
type FileTransport struct {
*Transport
// contains filtered or unexported fields
}
FileTransport is a struct that represents a transport for logging to a file.
func NewFileTransport ¶
func NewFileTransport(name string, level Level, filepath string) *FileTransport
NewFileTransport is a constructor function that creates a new instance of FileTransport.
func (*FileTransport) Close ¶
func (f *FileTransport) Close()
Close is a method that flushes the writer's buffer to the file and closes the file.
func (*FileTransport) Flush ¶
func (f *FileTransport) Flush()
Flush is a method that flushes the writer's buffer to the file.
func (*FileTransport) FlushSync ¶
func (f *FileTransport) FlushSync()
FlushSync is a method that synchronously flushes the writer's buffer to the file.
func (*FileTransport) Log ¶
func (f *FileTransport) Log(formattedData string, _ *LogData)
Log is a method that writes formattedData to the file.
func (*FileTransport) Reload ¶
func (f *FileTransport) Reload()
Reload is a method that flushes the writer's buffer to the file, reloads the file, and closes the old file.
type ITransport ¶
type ITransport interface {
Enable()
Disable()
ShouldLog(level Level) bool
Log(formattedData string, data *LogData)
Flush()
FlushSync()
Reload()
Close()
}
ITransport Define an interface called ITransport with several methods
type Logger ¶
type Logger struct {
*LoggerCore
}
func NewLogger ¶
func NewLogger(options *LoggerOptions) *Logger
type LoggerCore ¶
type LoggerCore struct {
// contains filtered or unexported fields
}
func NewLoggerCore ¶
func NewLoggerCore(name string, level Level) *LoggerCore
func (*LoggerCore) AddTransport ¶
func (l *LoggerCore) AddTransport(name string, transport ITransport)
func (*LoggerCore) Close ¶
func (l *LoggerCore) Close()
func (*LoggerCore) CloseAllTransport ¶
func (l *LoggerCore) CloseAllTransport()
func (*LoggerCore) CloseTransport ¶
func (l *LoggerCore) CloseTransport(name string)
func (*LoggerCore) Debug ¶
func (l *LoggerCore) Debug(format string, v ...interface{})
func (*LoggerCore) DisableTransport ¶
func (l *LoggerCore) DisableTransport(name string)
func (*LoggerCore) EnableTransport ¶
func (l *LoggerCore) EnableTransport(name string)
func (*LoggerCore) Error ¶
func (l *LoggerCore) Error(format string, v ...interface{})
func (*LoggerCore) Fatal ¶
func (l *LoggerCore) Fatal(format string, v ...interface{})
func (*LoggerCore) Flush ¶
func (l *LoggerCore) Flush()
func (*LoggerCore) FlushSync ¶
func (l *LoggerCore) FlushSync()
func (*LoggerCore) GetTransport ¶
func (l *LoggerCore) GetTransport(name string) ITransport
func (*LoggerCore) Info ¶
func (l *LoggerCore) Info(format string, v ...interface{})
func (*LoggerCore) Log ¶
func (l *LoggerCore) Log(level Level, format string, v ...interface{})
func (*LoggerCore) ReloadAllTransports ¶
func (l *LoggerCore) ReloadAllTransports()
func (*LoggerCore) ReloadTransport ¶
func (l *LoggerCore) ReloadTransport(name string)
func (*LoggerCore) RemoveTransport ¶
func (l *LoggerCore) RemoveTransport(name string)
func (*LoggerCore) Trace ¶
func (l *LoggerCore) Trace(format string, v ...interface{})
func (*LoggerCore) Warn ¶
func (l *LoggerCore) Warn(format string, v ...interface{})