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
- func Capture(cfg *config.Config, path string) (*os.File, error)
- func Component(caller string) string
- func Ends(paths []string) []int64
- func File(cfg *config.Config, path string) *logx.File
- func Follow(ctx context.Context, paths []string, offsets []int64, filter Filter, ...) error
- func In(caller, name string) bool
- func Lines(cfg *config.Config, path string, stamped bool) *logx.LineWriter
- func Masking(file *logx.File, stamped bool) *logx.LineWriter
- func Note(path, text string) error
- func Readable(text string) string
- func Since(words string, now time.Time) (time.Time, error)
- func Weight(word string) (string, bool)
- type Exit
- type Failure
- type Field
- type Filter
- type Log
- type Logs
- func (l *Logs) Alone() (back func())
- func (l *Logs) Catalog(cfg *config.Config) []Log
- func (l *Logs) Close() error
- func (l *Logs) Delete(profile string) error
- func (l *Logs) Exits() []Exit
- func (l *Logs) Failing() map[string]Failure
- func (l *Logs) Find(cfg *config.Config, name string) (Log, bool)
- func (l *Logs) Folder() string
- func (l *Logs) FolderOf(profile string) string
- func (l *Logs) Knowing(known func(cfg *config.Config) []string)
- func (l *Logs) Known(cfg *config.Config) []string
- func (l *Logs) Named(cfg *config.Config) []Named
- func (l *Logs) Naming(named func(cfg *config.Config) []Named)
- func (l *Logs) Open()
- func (l *Logs) Path(name string) string
- func (l *Logs) Rename(old, renamed string) error
- func (l *Logs) Serves()
- func (l *Logs) Shown(cfg *config.Config) (some, all bool)
- func (l *Logs) Stop(profile string) error
- func (l *Logs) Watching(watch func(level zerolog.Level, profile string, fields map[string]string))
- type Named
- type Record
Constants ¶
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
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 ¶
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 ¶
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 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 ¶
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 ¶
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 ¶
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 ¶
A text of log lines with each record of icebath in it as a line a person reads, every other line as it is
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 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
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
type Logs ¶
type Logs struct {
// contains filtered or unexported fields
}
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 ¶
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 ¶
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) Exits ¶
The icebath processes of this icebath folder that ended without stopping, as many as are kept, the last found last
func (*Logs) Failing ¶
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 ¶
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 ¶
Folder of the logs of the icebath folder, which take the records of no profile
func (*Logs) Knowing ¶
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 ¶
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 ¶
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 ¶
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) Rename ¶
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 ¶
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 ¶
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
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 ¶
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