logging

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 2, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// FieldRemoteAddr is the log field name for the remote address of an HTTP request.
	FieldRemoteAddr = "remote_addr"

	// FieldMethod is the log field name for the HTTP method used in a request.
	FieldMethod = "method"

	// FieldPath is the log field name for the requested URL path.
	FieldPath = "path"

	// FieldReferer is the log field name for the HTTP referer header.
	FieldReferer = "referer"

	// FieldUserAgent is the log field name for the HTTP user agent header.
	FieldUserAgent = "user_agent"

	// FieldStatusCode is the log field name for the HTTP response status code.
	FieldStatusCode = "status_code"

	// FieldResponseTime is the log field name for the time taken to respond to a request.
	FieldResponseTime = "response_time"

	// FieldError is the log field name for error information.
	FieldError = "error"

	// FieldService is the log field name for the service identifier.
	FieldService = "service"

	// FieldEnvironment is the log field name for the application environment.
	FieldEnvironment = "environment"

	// FieldVersion is the log field name for the application version.
	FieldVersion = "version"

	// FieldServerAddr is the log field name for the server's address.
	FieldServerAddr = "server_addr"

	// FieldLoggingLevel is the log field name for the logging level.
	FieldLoggingLevel = "logging_level"

	// FieldDuration is the log field name for durations in milliseconds.
	FieldDuration = "duration_ms"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger struct {
	*zap.Logger
}

func NewLogger

func NewLogger(env string) (*Logger, error)

func (*Logger) LogAppError

func (l *Logger) LogAppError(msg string, err error, fields ...zap.Field)

func (*Logger) LogAppInfo

func (l *Logger) LogAppInfo(msg string, fields ...zap.Field)

func (*Logger) LogAppWarn

func (l *Logger) LogAppWarn(msg string, fields ...zap.Field)

func (*Logger) LogRequestError

func (l *Logger) LogRequestError(msg string, r *http.Request, err error)

func (*Logger) LogRequestInfo

func (l *Logger) LogRequestInfo(msg string, r *http.Request)

func (*Logger) LogRequestWarn

func (l *Logger) LogRequestWarn(msg string, r *http.Request)

Jump to

Keyboard shortcuts

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