loggergo

package module
v1.0.15 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2024 License: Apache-2.0 Imports: 14 Imported by: 7

README

loggergo

GitHub tag (with filter) Go Reference Maintainability

Logging library I've come up with in order unify way my apps implement logging.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoggerInit

func LoggerInit(ctx context.Context, config LoggerGoConfig, additionalAttrs ...any) (*slog.Logger, error)

The LoggerInit function initializes a logger with the provided configuration and additional attributes.

Types

type LoggerGoConfig

type LoggerGoConfig struct {
	Level                 string `json:"level"`                    // Level specifies the log level. Valid values are "debug", "info", "warn", and "error".
	Format                string `json:"format"`                   // Format specifies the log format. Valid values are "text" and "json".
	DevMode               bool   `json:"dev_mode"`                 // Dev indicates whether the logger is running in development mode.
	DevFlavor             string `json:"dev_flavor"`               // DevFlavor specifies the development flavor. Valid values are "tint" (default), slogor and "devslog".
	OutputStream          string `json:"output_stream"`            // OutputStream specifies the output stream. Valid values are "stdout" (default) and "stderr".
	OtelTracingEnabled    bool   `json:"otel_enabled"`             // OtelTracingEnabled specifies whether OpenTelemetry support is enabled. Default is true.
	OtelLoggerName        string `json:"otel_logger_name"`         // OtelLoggerName specifies the name of the logger for OpenTelemetry.
	OtelLogsBridgeEnabled bool   `json:"otel_logs_bridge_enabled"` // OtelLogsBridgeEnabled specifies whether the OpenTelemetry logs bridge is enabled. Default is false.
}

LoggerGoConfig represents the configuration options for the LoggerGo logger.

Jump to

Keyboard shortcuts

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