logging

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

* This is the logging setup for ttxt: * - Uses zerolog for logging * - Uses console writer for human-readable output * - Maps command line flags to log levels: * - -v: Info * - -vv: Debug * - -vvv: Trace * - Level Guideline: * - Warn: is the default level. * - Info: short messages signaling entry / exit of relevant execution points. * may include some details about the execution, but not significant * amount of data * - Debug: detailed messages for debugging, which include some data. * - Trace: very detailed messages for debugging, which include quiet a bit * of data. * - The core idea is : * what's going on? info. * what is this returning that? debug. * what is happening to this variable? trace.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTestLogger

func NewTestLogger(t *testing.T) zerolog.Logger

NewTestLogger creates a logger for testing that integrates with Go's testing framework

func Setup

func Setup(config *Config)

Setup configures the global zerolog logger with the given configuration

Types

type Config

type Config struct {
	Level  LogLevel
	Writer io.Writer
}

Config holds the logging configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default logging configuration

type LogLevel

type LogLevel int

LogLevel represents the available log levels

const (
	WarnLevel LogLevel = iota
	InfoLevel
	DebugLevel
	TraceLevel
)

func ParseVerbosityFlags

func ParseVerbosityFlags(verbose, v, vv, vvv bool) LogLevel

ParseVerbosityFlags converts CLI verbosity flags to LogLevel

func (LogLevel) String

func (l LogLevel) String() string

String returns the string representation of the log level

func (LogLevel) ToZerologLevel

func (l LogLevel) ToZerologLevel() zerolog.Level

ToZerologLevel converts our LogLevel to zerolog.Level

Directories

Path Synopsis
Package markdown provides markdown parsing, transformation, and rendering capabilities for nanodoc.
Package markdown provides markdown parsing, transformation, and rendering capabilities for nanodoc.

Jump to

Keyboard shortcuts

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