Documentation ¶
Index ¶
- Constants
- func Debug(a ...any)
- func Debugf(format string, a ...any)
- func Error(err error) bool
- func Fatal(err error) bool
- func Info(a ...any)
- func Infof(format string, a ...any)
- func Message(a ...any)
- func Messagef(format string, a ...any)
- func Panic(err error) bool
- func SetLevel(l levels.TYPE)
- func Success(a ...any)
- func Successf(format string, a ...any)
- func Trace()
- func Warn(a ...any)
- func Warnf(format string, a ...any)
- type Logger
- func (l *Logger) Debug(v ...any)
- func (l *Logger) Debugf(format string, a ...any)
- func (l *Logger) Error(err error) bool
- func (l *Logger) Fatal(err error) bool
- func (l *Logger) Info(v ...any)
- func (l *Logger) Infof(format string, a ...any)
- func (l *Logger) Message(v ...any)
- func (l *Logger) Messagef(format string, a ...any)
- func (l *Logger) Panic(err error) bool
- func (l *Logger) Success(v ...any)
- func (l *Logger) Successf(format string, a ...any)
- func (l *Logger) Trace()
- func (l *Logger) Warn(v ...any)
- func (l *Logger) Warnf(format string, a ...any)
- func (l *Logger) Write(level levels.TYPE, messages ...any)
Constants ¶
const PATH = "| \033[38;5;%sm%s\033[39;49m |"
Constant for formatting log path with color.
Variables ¶
This section is empty.
Functions ¶
func Debug ¶
func Debug(a ...any)
Debug logs a message with Debug level. It logs detailed debugging information.
Parameters: - v: ...any The message or variables to log.
func Debugf ¶ added in v0.23.24
Debug logs a message with Debug level. It logs detailed debugging information.
Parameters: - v: ...any The message or variables to log.
func Error ¶
Error logs a message with Error level. It logs an error message, used for non-critical failures.
Parameters: - err: error The error to log.
Returns: - bool: true if the message was successfully logged, otherwise false.
func Fatal ¶
Fatal logs a message with Fatal level. It logs a critical error message and typically exits the program.
Parameters: - err: error The error to log.
Returns: - bool: true if the message was successfully logged, otherwise false.
func Info ¶
func Info(a ...any)
Info logs a message with Info level. It logs informational messages, useful for tracking the flow of the application.
Parameters: - v: ...any The message or variables to log.
func Infof ¶ added in v0.23.24
Info logs a message with Info level. It logs informational messages, useful for tracking the flow of the application.
Parameters: - v: ...any The message or variables to log.
func Message ¶
func Message(a ...any)
Message logs a message with Message level. It logs a general, informational message.
Parameters: - v: ...any The message or variables to log.
func Messagef ¶ added in v0.23.24
Message logs a message with Message level. It logs a general, informational message.
Parameters: - v: ...any The message or variables to log.
func Panic ¶
Panic logs a message with Panic level. It logs a message and then panics.
Parameters: - err: error The error to log.
Returns: - bool: true if the message was successfully logged, otherwise false.
func SetLevel ¶
SetLevel sets the log level of the standard logger. This function allows dynamic adjustment of the logging level.
Parameters: - l: levels.TYPE The log level to set for the standard logger.
func Success ¶
func Success(a ...any)
Success logs a message with Success level. It logs a success or completion message.
Parameters: - v: ...any The message or variables to log.
func Successf ¶ added in v0.23.24
Success logs a message with Success level. It logs a success or completion message.
Parameters: - v: ...any The message or variables to log.
func Trace ¶
func Trace()
Trace logs a message with Trace level. It logs the most detailed information, often for tracing code execution paths.
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger struct holds the logging configuration and loggers for different levels.
func New ¶
New creates a new Logger instance with the specified writer type and log level. It initializes two loggers: one for success and another for failure messages.
Parameters: - t: writers.TYPE The writer type (e.g., console, file) for the logger. - l: levels.TYPE The logging level for the logger.
Returns: - *Logger: A new Logger instance.
func (*Logger) Debug ¶
Debug logs the debug message with the DEBUG level. It provides detailed debug information for troubleshooting.
Parameters: - v: ...any The debug messages or data to log.
func (*Logger) Debugf ¶ added in v0.23.24
Debugf logs a debug message with formatted output. It is similar to Debug but allows for formatted messages.
Parameters: - format: string The format string. - a: ...any The arguments for formatting.
func (*Logger) Error ¶
Error logs the error with the ERROR level. It is used for logging general errors.
Parameters: - err: error The error to log.
Returns: - bool: true if the error is not nil, false otherwise.
func (*Logger) Fatal ¶
Fatal logs the error and stack trace with the FATAL level. It logs critical errors that might require the application to stop.
Parameters: - err: error The error to log.
Returns: - bool: true if the error is not nil, false otherwise.
func (*Logger) Info ¶
Info logs the info message with the INFO level. It is used for logging informational messages.
Parameters: - v: ...any The informational messages or data to log.
func (*Logger) Infof ¶ added in v0.23.24
Infof logs an informational message with formatted output. It is similar to Info but allows for formatted messages.
Parameters: - format: string The format string. - a: ...any The arguments for formatting.
func (*Logger) Message ¶
Message logs the message with the MESSAGE level. It is used for general-purpose logging.
Parameters: - v: ...any The messages or data to log.
func (*Logger) Messagef ¶ added in v0.23.24
Messagef logs a general message with formatted output. It is similar to Message but allows for formatted messages.
Parameters: - format: string The format string. - a: ...any The arguments for formatting.
func (*Logger) Panic ¶
Panic logs the error and stack trace with the PANIC level. It logs the error and a stack trace for debugging.
Parameters: - err: error The error to log.
Returns: - bool: true if the error is not nil, false otherwise.
func (*Logger) Success ¶
Success logs the success message with the SUCCESS level. It is used for logging successful operations.
Parameters: - v: ...any The success messages or data to log.
func (*Logger) Successf ¶ added in v0.23.24
Successf logs a success message with formatted output. It is similar to Success but allows for formatted messages.
Parameters: - format: string The format string. - a: ...any The arguments for formatting.
func (*Logger) Trace ¶
func (l *Logger) Trace()
Trace logs the stack trace with the TRACE level. It is used for logging detailed execution traces for in-depth debugging.
func (*Logger) Warn ¶
Warn logs the warning message with the WARN level. It is used for logging potential issues or warnings.
Parameters: - v: ...any The warning messages or data to log.
func (*Logger) Warnf ¶ added in v0.23.24
Warnf logs a warning message with formatted output. It is similar to Warn but allows for formatted messages.
Parameters: - format: string The format string. - a: ...any The arguments for formatting.