logger

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	FilePath       string // Path to the log file
	PrintToConsole bool   // Whether to print logs to the console
}

Config holds the configuration for the Logger.

type Logger

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

Logger provides logging functionality with optional file output and console printing.

func New

func New(config Config) (*Logger, error)

New creates a new Logger instance based on the provided configuration.

func (*Logger) Close

func (l *Logger) Close() error

Close closes the log file if it was opened.

func (*Logger) Debug

func (l *Logger) Debug(msg string, args ...interface{})

Debug logs a message with the DEBUG level.

func (*Logger) DebugWithPrefix

func (l *Logger) DebugWithPrefix(prefix string, msg string, args ...interface{})

DebugWithPrefix logs a message with a custom prefix at the DEBUG level.

func (*Logger) Error

func (l *Logger) Error(msg string, args ...interface{})

Error logs a message with the ERROR level.

func (*Logger) ErrorWithPrefix

func (l *Logger) ErrorWithPrefix(prefix string, msg string, args ...interface{})

ErrorWithPrefix logs a message with a custom prefix at the ERROR level.

func (*Logger) Info

func (l *Logger) Info(msg string, args ...interface{})

Info logs a message with the INFO level.

func (*Logger) InfoWithPrefix

func (l *Logger) InfoWithPrefix(prefix string, msg string, args ...interface{})

InfoWithPrefix logs a message with a custom prefix at the INFO level.

func (*Logger) Warning

func (l *Logger) Warning(msg string, args ...interface{})

Warning logs a message with the WARNING level.

func (*Logger) WarningWithPrefix

func (l *Logger) WarningWithPrefix(prefix string, msg string, args ...interface{})

WarningWithPrefix logs a message with a custom prefix at the WARNING level.

Jump to

Keyboard shortcuts

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