observability

package
v0.1.0-alpha.9 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Copyright (c) 2025 Nexlayer. All rights reserved.n// Use of this source code is governed by an MIT-stylen// license that can be found in the LICENSE file.nn

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogLevel

type LogLevel int

LogLevel represents the severity of a log entry.

const (
	DEBUG LogLevel = iota
	INFO
	WARN
	ERROR
)

func (LogLevel) String

func (level LogLevel) String() string

type Logger

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

Logger provides structured logging capabilities.

func NewLogger

func NewLogger(level LogLevel, opts ...LoggerOption) *Logger

NewLogger creates a new logger instance.

func (*Logger) Debug

func (l *Logger) Debug(ctx context.Context, msg string, args ...interface{})

func (*Logger) Error

func (l *Logger) Error(ctx context.Context, msg string, args ...interface{})

func (*Logger) Info

func (l *Logger) Info(ctx context.Context, msg string, args ...interface{})

func (*Logger) Warn

func (l *Logger) Warn(ctx context.Context, msg string, args ...interface{})

type LoggerOption

type LoggerOption func(*Logger)

LoggerOption allows configuring the logger with functional options.

func WithJSON

func WithJSON() LoggerOption

WithJSON enables JSON-formatted logging.

func WithRotation

func WithRotation(maxSizeMB int64, maxAgeDays int) LoggerOption

WithRotation enables log rotation with specified max size and age.

Jump to

Keyboard shortcuts

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