clog

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: GPL-3.0 Imports: 3 Imported by: 10

Documentation

Overview

Package clog is the one logger every katbyte tool logs through: stderr, since stdout is the tool's real output, with timestamps, at WARN unless the tool's own variable (TCTEST_LOG, KOI_LOG) raises it.

Index

Constants

View Source
const DefaultLevel = logrus.WarnLevel

DefaultLevel is where a logger starts: warnings and errors only.

View Source
const FallbackLevel = logrus.TraceLevel

FallbackLevel is the level a string that does not parse gets: the most verbose, so a typo shows everything rather than hiding what was wanted.

View Source
const TimestampFormat = "2006-01-02 15:04:05"

TimestampFormat is the timestamp layout, for a tool that builds its own formatter to match.

Variables

View Source
var Log = New()

Log is the one logger the whole process uses, so setting its level once sets it for everything.

Functions

func New

func New() *logrus.Logger

New is a logger set up as Log is, for the rare second logger with a level of its own.

func NewWithOutput

func NewWithOutput(w io.Writer) *logrus.Logger

NewWithOutput is New writing to w, so a test can capture the log.

func SetLevel

func SetLevel(level string)

SetLevel sets Log's level from a string such as "debug", by the same rules as SetLevelFromEnv, so a flag and the variable behave alike.

func SetLevelFromEnv

func SetLevelFromEnv(envVar string)

SetLevelFromEnv sets Log's level from a variable such as "TCTEST_LOG": unset leaves DefaultLevel, a value that does not parse gives FallbackLevel and logs the typo. Call it once, before any logging that matters.

Types

This section is empty.

Jump to

Keyboard shortcuts

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