logging

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package logging provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.5.1 DO NOT EDIT.

Package logging provides configurable zap logger creation for Antfly/Termite services.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSwagger

func GetSwagger() (swagger *openapi3.T, err error)

GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.

func NewLogfmtEncoder

func NewLogfmtEncoder(cfg zapcore.EncoderConfig) zapcore.Encoder

NewLogfmtEncoder creates a new logfmt encoder.

func NewLogger

func NewLogger(c *Config) *zap.Logger

NewLogger creates a zap logger based on the Config settings. If config is nil or has empty values, defaults to terminal style with info level.

func PathToRawSpec

func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)

Constructs a synthetic filesystem for resolving external references when loading openapi specifications.

Types

type Config

type Config struct {
	// Level Logging verbosity level
	Level Level `json:"level,omitempty,omitzero"`

	// Style Logging output format style. 'terminal' for colorized console, 'json' for structured JSON, 'logfmt' for token-efficient key=value pairs, 'noop' for silent.
	Style Style `json:"style,omitempty,omitzero"`
}

Config Logging configuration for Termite services

type Level

type Level string

Level Logging verbosity level

const (
	LevelDebug Level = "debug"
	LevelError Level = "error"
	LevelInfo  Level = "info"
	LevelWarn  Level = "warn"
)

Defines values for Level.

type Style

type Style string

Style Logging output format style. 'terminal' for colorized console, 'json' for structured JSON, 'logfmt' for token-efficient key=value pairs, 'noop' for silent.

const (
	StyleJson     Style = "json"
	StyleLogfmt   Style = "logfmt"
	StyleNoop     Style = "noop"
	StyleTerminal Style = "terminal"
)

Defines values for Style.

Jump to

Keyboard shortcuts

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