Skip to main content

event_log.go

event_log.go - Overview

This file defines an interface for event logging using the golang.org/x/net/trace package, along with a no-op implementation.

Detailed Documentation

NoEventLog

var (
NoEventLog trace.EventLog = nilEventLog{}
)
  • Purpose: A global variable that represents a no-op event logger. It is an instance of nilEventLog which implements the trace.EventLog interface without performing any actual logging.

nilEventLog

type nilEventLog struct{}
  • Purpose: Implements the trace.EventLog interface, but all methods are no-ops. This is useful when event logging is not desired.

nilEventLog.Printf

func (nel nilEventLog) Printf(format string, a ...interface{}) {}
  • Purpose: A no-op implementation of the Printf method from the trace.EventLog interface. It takes a format string and a variable number of arguments, but performs no action.
  • Parameters:
    • format: The format string (string).
    • a: A variable number of arguments (interface{}).
  • Returns: None.

nilEventLog.Errorf

func (nel nilEventLog) Errorf(format string, a ...interface{}) {}
  • Purpose: A no-op implementation of the Errorf method from the trace.EventLog interface. It takes a format string and a variable number of arguments, but performs no action.
  • Parameters:
    • format: The format string (string).
    • a: A variable number of arguments (interface{}).
  • Returns: None.

nilEventLog.Finish

func (nel nilEventLog) Finish() {}
  • Purpose: A no-op implementation of the Finish method from the trace.EventLog interface. It performs no action.
  • Returns: None.

Getting Started Relevance