config

package
v0.0.0-...-a4a517a Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetIsLogger

func SetIsLogger(logger bool)

func ZenlogSrcTopDir

func ZenlogSrcTopDir() string

ZenlogSrcTopDir returns the fullpath of the source top directory.

Types

type Config

type Config struct {
	LogDir              string `toml:"ZENLOG_DIR"`
	TempDir             string `toml:"ZENLOG_TEMP"`
	SourceDir           string `toml:"ZENLOG_SOURCE_DIR"`
	StartCommand        string `toml:"ZENLOG_START_COMMAND"`
	PrefixCommands      string `toml:"ZENLOG_PREFIX_COMMANDS"`
	AlwaysNoLogCommands string `toml:"ZENLOG_ALWAYS_NO_LOG_COMMANDS"`
	AutoFlush           bool   `toml:"ZENLOG_AUTO_FLUSH"`

	UseExperimentalCommandParser bool   `toml:"ZENLOG_USE_EXPERIMENTAL_COMMAND_PARSER"`
	CommandSplitter              string `toml:"ZENLOG_COMMAND_SPLITTER"`
	CommentSplitter              string `toml:"ZENLOG_COMMENT_SPLITTER"`

	Maxproc                 int `toml:"ZENLOG_MAXPROC"`
	CriticalCrashMaxSeconds int `toml:"ZENLOG_CRITICAL_CRASH_MAX_SECONDS"`

	UseSplice bool `toml:"ZENLOG_USE_SPLICE"`

	ZenlogPid int

	OuterTty  string
	LoggerIn  string
	LoggerOut string
}

Config represents configuration parameters, read from ~/.zenlog.toml and overridden with the environmental variables.

func GetConfig

func GetConfig() *Config

GetConfig returns the singleton config suitable for the current run mode.

func InitConfigForCommands

func InitConfigForCommands() *Config

InitConfigForCommands returns a Config for subcommands, loading from ~/.zenlog.toml and the environmental variables. Some of the parameters (such as ZenlogPid) will be inherited from the current zenlog session.

func InitConfigForLogger

func InitConfigForLogger() *Config

InitConfigForLogger returns a Config for a new session, loading from ~/.zenlog.toml and the environmental variables.

Jump to

Keyboard shortcuts

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