app/

directory
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2020 License: MIT, Unlicense

README

app

App is a library wrapped around github.com/urfave/cli that makes neater declarations, dynamically generates a concurrent safe, tag-grouped configuration database with the change hooks that sanitise values, can trigger running responses such as restarting a subsystem or as needed, then efficiently modifies a cached, marshalled form of the configuration (JSON) and syncs to disk, in the configured data directory.

See example folder for an example. The example can easily be used to start a new app.

In addition here in this repo are platform specific data directory code, various generic filesystem helpers, and an interrupt handling library to enable clean shutdown and restarts.

Rationale

When writing applications, there is normally a constant need to change, add and remove config and subcommands before the app is complete. With complex, pluggable applications, subcommands allow a simpler, monolithic runtime that can launch child processes, for use with pipe IPC.

App centralises the specification, and automatically generates a config system with caching and change hooks to allow hot dynamic reconfiguration, and simple context access to subsystems to read and potentially write configuration data concurrently.

Directories

Path Synopsis
cmd
Package log creates a neat short access to logger functions for a simple app-wide namespace (package global, this package need only be imported) for use of slog/simple logger implementation
Package log creates a neat short access to logger functions for a simple app-wide namespace (package global, this package need only be imported) for use of slog/simple logger implementation
Entry
Package Entry is a message type for logi log entries
Package Entry is a message type for logi log entries
Pkg
Package Package is a message type for logi package filtering
Package Package is a message type for logi package filtering
consume
Package consume turns off and on the Serve logging messages and provides a way to receive and process the log messages
Package consume turns off and on the Serve logging messages and provides a way to receive and process the log messages
logi
Package logi is a logger interface designed to allow easy extension with log printer functions and complete reimplementation as required
Package logi is a logger interface designed to allow easy extension with log printer functions and complete reimplementation as required
serve
Package serve receives logi.Entry messages on a channel and sends them when it has been told to Run by Consume, and pauses when it is told Pause
Package serve receives logi.Entry messages on a channel and sends them when it has been told to Run by Consume, and pauses when it is told Pause
simple
Package simple is an implementation of the logi.Logger interface that prints log entries to stdout with level code, compact since startup time.Duration and appends the code location of the call to the logger at the end of the log text.
Package simple is an implementation of the logi.Logger interface that prints log entries to stdout with level code, compact since startup time.Duration and appends the code location of the call to the logger at the end of the log text.

Jump to

Keyboard shortcuts

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