logger

package
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompletedConfig

type CompletedConfig struct {
	*Config
}

CompletedConfig is a completed configuration ready to create a logger.

It wraps Config and provides the NewLogger method to initialize the logger with the configured options.

func (CompletedConfig) NewLogger

func (c CompletedConfig) NewLogger() (*Logger, error)

NewLogger creates and initializes a new Logger instance.

It performs the following initialization steps:

  1. Creates log directories for all output paths (excluding stdout/stderr).
  2. Initializes the underlying logging system with Info and Error log options.

Returns an error if directory creation or logger initialization fails.

type Config

type Config struct {
	// InfoLogOpts holds configuration for Info-level log output.
	InfoLogOpts *logV1.Options
	// ErrLogOpts holds configuration for Error-level log output.
	ErrLogOpts *logV1.Options
}

Config holds the configuration for creating a logger.

It contains separate options for Info-level and Error-level log outputs, allowing independent configuration of log levels, output paths, and formatting.

func NewConfig

func NewConfig() *Config

NewConfig creates a new Config with default options for both Info and Error logs.

func (*Config) Complete

func (c *Config) Complete() CompletedConfig

Complete transforms Config into a CompletedConfig for logger creation.

type Logger

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

Logger provides a wrapper for logger initialization and flushing.

It encapsulates the initialization logic (including directory creation and logger setup) and provides a Flush method to ensure all buffered log entries are written before the application exits.

func (*Logger) Flush

func (l *Logger) Flush()

Flush ensures all buffered log entries are written to their destinations. It should be called before the application exits to prevent log loss.

func (*Logger) Init

func (l *Logger) Init() error

Init initializes the logger by creating log directories and setting up the underlying logging system. It should be called once during application startup.

Jump to

Keyboard shortcuts

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