Skip to main content

logger.go

logger.go - Overview

  1. Overview This file defines a simple logger structure and its methods for debug and error logging using the standard log package.

  2. Detailed Documentation

Logger

  • Purpose: Defines a logger structure that wraps the standard log.Logger.
  • Parameters: None
  • Returns: None
type Logger struct {
logger *log.Logger
}

Debugf

  • Purpose: Logs a formatted debug message.
  • Parameters:
    • format (string): The format string for the log message.
    • v (...interface{}): The values to be formatted into the log message.
  • Returns: None
func (l *Logger) Debugf(format string, v ...interface{}) {
l.logger.Printf(format, v...)
}

Errorf

  • Purpose: Logs a formatted error message.
  • Parameters:
    • format (string): The format string for the log message.
    • v (...interface{}): The values to be formatted into the log message.
  • Returns: None
func (l *Logger) Errorf(format string, v ...interface{}) {
l.logger.Printf(format, v...)
}

Include in Getting Started: NO