logs

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 29 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

The log files of icebath: every record each process writes, routed to the logs folder of the profile it belongs to or, for a record of no profile, of the icebath folder: every record from the level the settings set, the warnings and errors apart, and the records of each part the settings name in a file of the part's own. Every text masked, every file turned over once it grows past its size, and several processes writing one safely. The log files every feature keeps are written the same way through File, Lines, Capture and Note. The terminal shows what the settings say of the log, which left to themselves is all of it while the log keeps every record, for finding out what went wrong, and otherwise none of it but the warnings and errors of icebath server, and nothing while the terminal app draws over it; a process that ended without stopping is told of at the next start, and what the runtime said as one crashed is kept

Index

Constants

View Source
const (
	// Every record from the level the settings set
	Main = "icebath.log"
	// Warnings and errors alone, whatever the level
	Errors = "errors.log"
	// What the runtime says as a process dies, in the logs folder of the icebath folder
	Crashes = "crash.log"
)

Names of the log files of icebath in a logs folder

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

Layout of the time a line of a feature's log starts with

Variables

This section is empty.

Functions

func Capture

func Capture(cfg *config.Config, path string) (*os.File, error)

The file a program a feature starts writes its output to when the program outlives icebath, so no process of icebath can carry its lines: what the one before wrote turned over first, as many kept as the settings give, made as log files are. Name it in the feature's status.Logger, and the logs keep it within the size the settings give as it grows

func Component

func Component(caller string) string

Part of icebath a record was written from, by the place in the code its caller names: the plugin, the core host or the package of the program, the package for code of others; empty for a record that names none

func Ends

func Ends(paths []string) []int64

Size of each file now, which a follow goes on from after a read up to it

func File

func File(cfg *config.Config, path string) *logx.File

A log file a feature keeps at the path, written as every log of icebath is: turned over at the size the settings give with as many kept, owner-only, several processes writing it safely, its folder made when missing and the one above it never. Each line written to it is the feature's to mask with redact.Logged

func Follow

func Follow(ctx context.Context, paths []string, offsets []int64, filter Filter, send func(records []Record, offsets []int64) error) error

Sends the records written to the files from the offsets on that pass the filter, as they are written, with where the follow is in each file after them, until ctx ends or send fails: a file turned over is read to its end and then the new one from its start, and one emptied or turned over since its offset was given is read again from its start. The ends of the files are the offsets of those none is given for

func In

func In(caller, name string) bool

Whether the place in the code a record was written from is in a folder of the name, such as gateway for the gateway host and the gateway part of every chat app

func Lines

func Lines(cfg *config.Config, path string, stamped bool) *logx.LineWriter

What a program a feature runs writes to its standard output or error, into the log file the feature keeps at the path: each whole line masked as every log line is and, when stamped, led by the time it came. Close writes what is left and closes the file

func Masking

func Masking(file *logx.File, stamped bool) *logx.LineWriter

What one program writes, into a log file several programs write: each whole line masked as every log line is and, when stamped, led by the time it came, so the lines of the programs never mix. Flush writes what is left; Close closes the file too

func Note

func Note(path, text string) error

Writes a whole report to a file of its own, masked as every log is, such as the output of a failed step

func Readable

func Readable(text string) string

A text of log lines with each record of icebath in it as a line a person reads, every other line as it is

func Since

func Since(words string, now time.Time) (time.Time, error)

The time the words say records are read from: a length of time back from now, such as 30m, 2h or 1d, a day, a day and time, or a time of today; an error a person reads for words that say none

func Weight

func Weight(word string) (string, bool)

The level a word names in any case, such as WARNING or WRN for warn; false for a word that names none

Types

type Exit

type Exit struct {
	PID int `json:"pid"`
	// server for icebath server, window for the app or a command
	Purpose string `json:"purpose"`
	Version string `json:"version"`
	// Profile it worked on, empty for icebath server
	Profile string    `json:"profile,omitempty"`
	Started time.Time `json:"started"`
	// When it was found gone without having stopped, zero while it runs
	Found time.Time `json:"found,omitzero"`
	// The runtime wrote crash.log after it started, which holds what it said as it died
	Crashed bool `json:"crashed,omitempty"`
}

An icebath process as its stamp says it while it runs, and once it was found to have ended without stopping

type Failure

type Failure struct {
	Err   error
	Since time.Time
}

A log file whose writes fail

type Field

type Field struct {
	Name, Value string
}

A field of a record, its value as text

type Filter

type Filter struct {
	// Least level a record has, any when empty
	Level string
	// Part of icebath the records are of, or a folder of the code they were written from
	Component string
	// Session the records are of, or the start of its id
	Session string
	// Records written from this time on, any for zero
	Since time.Time
	// Words every record holds, in any case
	Search string
}

Which records of a log are read

func (Filter) Pass

func (f Filter) Pass(r Record) bool

Whether the record passes the filter; one that says no time or level passes those

type Log

type Log struct {
	// What a read picks it by, unique among the logs of a profile, such as icebath, errors or tool_calls
	Name  string
	Title string
	// Files it is read from as one
	Paths []string
	// A log of icebath itself, whose lines are records
	Own bool
	// Bytes it holds now, when it was last written, zero for never, and the files it turned over to that are kept
	Size    int64
	Written time.Time
	Older   int
}

A log a person picks to read: one of icebath itself, read from the files of the profile and of the icebath folder as one, or one a feature keeps

func Inside

func Inside(cfg *config.Config, file Log) (Log, bool)

The log with only its files inside the folder of the profile of the settings, as read from elsewhere than this computer, measured again; false when none of them is

func (Log) Every

func (f Log) Every(keep int) []string

The files a log is read from, each after the files it turned over to that are kept, the oldest of those first

type Logs

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

func New

func New(cfg *config.Config) *Logs

func (*Logs) Alone

func (l *Logs) Alone() (back func())

Has the records go to the log files alone until the function given back is called, as the terminal app draws over the terminal they would be drawn on; nothing changes before Open

func (*Logs) Catalog

func (l *Logs) Catalog(cfg *config.Config) []Log

The logs of the profile of the settings: those of icebath first, the warnings and errors and the parts kept apart after the one of every record, then the crash reports, then every log a feature keeps and every other log of the logs folders of the profile and of the icebath folder, each with its size and when it was written

func (*Logs) Close

func (l *Logs) Close() error

Says this process stopped, stops writing the records to the files and closes them. A process that ends before its logs opened, as one whose start failed, wrote records no file took: the terminal shows of them what the settings say it shows of the log of this process

func (*Logs) Delete

func (l *Logs) Delete(profile string) error

Lets go of the log files of a profile deleted, whose folder went with them

func (*Logs) Exits

func (l *Logs) Exits() []Exit

The icebath processes of this icebath folder that ended without stopping, as many as are kept, the last found last

func (*Logs) Failing

func (l *Logs) Failing() map[string]Failure

Why the log files of icebath of the profile could not be written last, each with since when, by path; none while every write goes through

func (*Logs) Find

func (l *Logs) Find(cfg *config.Config, name string) (Log, bool)

The log of the profile of the settings a person names: by its name or title in any case, its name with .log, or one of its paths

func (*Logs) Folder

func (l *Logs) Folder() string

Folder of the logs of the icebath folder, which take the records of no profile

func (*Logs) FolderOf

func (l *Logs) FolderOf(profile string) string

Folder of the logs of the profile, that of the icebath folder for none

func (*Logs) Knowing

func (l *Logs) Knowing(known func(cfg *config.Config) []string)

Has every record of a profile written with the values the profile keeps as secrets masked wherever they stand, besides the secrets the patterns know

func (*Logs) Known

func (l *Logs) Known(cfg *config.Config) []string

Values the profile of the settings keeps as secrets, which a text that leaves this computer has masked; none before main.go handed the way to them over

func (*Logs) Named

func (l *Logs) Named(cfg *config.Config) []Named

The log files every feature keeps for the profile of the settings, none before main.go handed the way to them over

func (*Logs) Naming

func (l *Logs) Naming(named func(cfg *config.Config) []Named)

Has the logs list, and keep within their size, the log files every feature keeps for a profile, as the report of the install names them

func (*Logs) Open

func (l *Logs) Open()

Starts writing the records of this process to the log files as the settings say, the records written since it started first. The terminal shows what the settings say it shows from here, of the records written since the process started too, none of which it showed before the settings were read. Opening again changes nothing

func (*Logs) Path

func (l *Logs) Path(name string) string

File of the log of the name in the logs folder of the icebath folder

func (*Logs) Rename

func (l *Logs) Rename(old, renamed string) error

Writes the records of the profile to the files of its folder again once it moved to its new name

func (*Logs) Serves

func (l *Logs) Serves()

Says this process serves every profile, as icebath server does: a record of it that names no profile belongs to none, where a window's belongs to the profile it works on, and the terminal shows what the settings say a server's shows, of a start that fails before the logs opened too

func (*Logs) Shown

func (l *Logs) Shown(cfg *config.Config) (some, all bool)

What the terminal of this process shows of the log while the app does not draw on it, as the settings given say: whether any of it, and whether every record the logs keep

func (*Logs) Stop

func (l *Logs) Stop(profile string) error

Lets go of the log files of the profile before its folder moves, its records written to the files of the icebath folder until it moved

func (*Logs) Watching

func (l *Logs) Watching(watch func(level zerolog.Level, profile string, fields map[string]string))

Has every warning and error the log writes handed to watch as it is written: its level, the profile it is of, empty for none, and the fields of the record that are text by name, masked as the files take them

type Named

type Named struct {
	// What a person calls it, such as Chat apps
	Title string
	Path  string
}

A log file a feature keeps, as the features name theirs in the report of the install

type Record

type Record struct {
	// When it was written, zero for a line that says none
	Time time.Time
	// How much it weighs, one of the levels; empty for a line that says none
	Level   string
	Message string
	// Place in the code it was written from, and the part of icebath that is
	Caller, Component string
	Session, Profile  string
	// Every other field it holds, in order
	Fields []Field
	// The lines as the file holds them
	Text string
}

One record of a log as a person reads it: a record of icebath, or a line of another log with the lines after it that say no time

func Parse

func Parse(line string) (Record, bool)

Reads a line of a log: a record of icebath, or a line of another log with the time and level it says. Whether it starts a record: a record of icebath, or a line that says its time; another line follows the record above it

func Tail

func Tail(paths []string, ends []int64, filter Filter, count int) ([]Record, bool)

The last records of the files up to the ends given, which pass the filter, as many as asked for: the files read as one by the time of each record. Whether more records pass before them

func (Record) Line

func (r Record) Line() string

The record as a line a person reads: its time, level, session and part, then its message and fields; a line of another log as it is

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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