logger

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package logger provides structured logging functionality for the application. It includes log initialization, configuration, and various log levels.

Package logger provides structured logging functionality for the application. It includes log initialization, configuration, and various log levels.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

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

func NewLogger

func NewLogger(opts LoggerOptions) *Logger

NewLogger initializes the logger with given options

func (Logger) Debug

func (lg Logger) Debug(msg string, keysAndValues ...any)

Debug logs a debug message with key-value pairs

func (Logger) Error

func (lg Logger) Error(msg string, keysAndValues ...any)

Error logs an error message with key-value pairs

func (Logger) Fatal

func (lg Logger) Fatal(msg string, keysAndValues ...any)

Fatal logs a fatal message with key-value pairs

func (Logger) Info

func (lg Logger) Info(msg string, keysAndValues ...any)

Info logs an informational message with key-value pairs

func (Logger) Sync

func (lg Logger) Sync()

Sync flushes any buffered log entries

func (Logger) Warn

func (lg Logger) Warn(msg string, keysAndValues ...any)

Warn logs a warning message with key-value pairs

type LoggerOptions

type LoggerOptions struct {
	Debug      bool // Enable debug logging
	NoOp       bool // Disable logging completely
	JSON       bool // Use JSON format for logs
	Caller     bool // Include caller info
	Stack      bool // Include stack trace in debug mode
	EncodeTime zapcore.TimeEncoder
}

LoggerOptions defines configurable parameters for the logger

func DefaultOptions

func DefaultOptions() LoggerOptions

DefaultOptions returns a default logger configuration

Jump to

Keyboard shortcuts

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