logx

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: May 12, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package logx provides a standard logger implementation for the gomcp project.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetLogLevelFromString added in v1.1.3

func SetLogLevelFromString(logger Logger, levelStr string)

SetLogLevelFromString sets the logging level from a string representation This is a utility function to help external callers set the log level

Types

type DefaultLogger

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

DefaultLogger provides a basic logger implementation using the standard log package.

func NewDefaultLogger

func NewDefaultLogger() *DefaultLogger

NewDefaultLogger creates a new logger writing to stderr with standard flags.

func (*DefaultLogger) Debug

func (l *DefaultLogger) Debug(msg string, args ...interface{})

func (*DefaultLogger) Error

func (l *DefaultLogger) Error(msg string, args ...interface{})

func (*DefaultLogger) Info

func (l *DefaultLogger) Info(msg string, args ...interface{})

func (*DefaultLogger) SetLevel

func (l *DefaultLogger) SetLevel(level protocol.LoggingLevel)

SetLevel updates the logging level for the DefaultLogger.

func (*DefaultLogger) Warn

func (l *DefaultLogger) Warn(msg string, args ...interface{})

type Logger

type Logger interface {
	Debug(format string, v ...interface{})
	Info(format string, v ...interface{})
	Warn(format string, v ...interface{})
	Error(format string, v ...interface{})
	SetLevel(level protocol.LoggingLevel)
}

Logger defines the interface for logging.

func NewLogger

func NewLogger(logType string) Logger

NewLogger creates a new logger instance based on the configuration. logType can be a log level string like "debug", "info", "warning", "error" or a custom prefix string for backward compatibility

func NewStandardLoggerAdapter added in v1.1.1

func NewStandardLoggerAdapter(logger *log.Logger) Logger

NewStandardLoggerAdapter creates a Logger that wraps a standard Go log.Logger

type StandardLoggerAdapter added in v1.1.1

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

StandardLoggerAdapter adapts a standard log.Logger to implement the Logger interface

func (*StandardLoggerAdapter) Debug added in v1.1.1

func (a *StandardLoggerAdapter) Debug(format string, v ...interface{})

Debug logs a debug message

func (*StandardLoggerAdapter) Error added in v1.1.1

func (a *StandardLoggerAdapter) Error(format string, v ...interface{})

Error logs an error message

func (*StandardLoggerAdapter) Info added in v1.1.1

func (a *StandardLoggerAdapter) Info(format string, v ...interface{})

Info logs an info message

func (*StandardLoggerAdapter) SetLevel added in v1.1.1

func (a *StandardLoggerAdapter) SetLevel(level protocol.LoggingLevel)

SetLevel sets the logging level

func (*StandardLoggerAdapter) Warn added in v1.1.1

func (a *StandardLoggerAdapter) Warn(format string, v ...interface{})

Warn logs a warning message

Jump to

Keyboard shortcuts

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