logging

package
v0.0.0-...-4530040 Latest Latest
Warning

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

Go to latest
Published: May 20, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package logging provides structured logging functionality for the application. It wraps the zap.SugaredLogger to enable easy and efficient logging with support for different log levels and structured log entries.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InterceptorLogger

func InterceptorLogger(l *zap.Logger) logging.Logger

Types

type LogEntry

type LogEntry interface {
	// Write logs the status, bytes, header, elapsed time, and extra information.
	Write(status, bytes int, header http.Header, elapsed time.Duration, extra interface{})
	// Panic logs a panic message with the stack trace.
	Panic(v interface{}, stack []byte)
}

LogEntry defines the interface for log entries.

type Logger

type Logger struct {
	*zap.SugaredLogger
}

Logger wraps the zap.SugaredLogger to provide structured logging.

func New

func New(level zapcore.Level) (*Logger, error)

New creates a new Logger instance with the specified log level.

func (*Logger) Close

func (l *Logger) Close() error

Close syncs the logger, flushing any buffered log entries.

func (*Logger) Debug

func (l *Logger) Debug(message string, keysAndValues ...interface{})

Debug logs a debug message with additional context.

func (*Logger) Error

func (l *Logger) Error(message string, keysAndValues ...interface{})

Error logs an error message with additional context.

func (*Logger) Fatal

func (l *Logger) Fatal(message string, keysAndValues ...interface{})

Fatal logs a fatal message with additional context and then exits the application.

func (*Logger) Info

func (l *Logger) Info(message string, keysAndValues ...interface{})

Info logs an informational message with additional context.

func (*Logger) Printf

func (l *Logger) Printf(format string, v ...interface{})

Printf logs a formatted informational message.

Jump to

Keyboard shortcuts

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