Crate system_service [−] [src]
A framework for writing system services
Every application which runs as a service should implement things like logging, signal handling, graceful shutdown, CLI option parsing, and configuration file parsing. This package provides a semi-opinionated framework for doing so.
There are several traits exported here including
LogOptions. The two options traits should be implemented
for your CLI option loadind,
Config for your config file loading, and
Application for your application logic.
The primary run method is
Application::run_once which is called over and
over again in a loop. It is provided a
Context type which gives the
application control of when it checks for signals. Any received signals are
Application::received_signal for handling.
Print a message to stderr and exit(1)
A context passed to
Indicates whether the run loop should halt
The application; domain-specific program logic
Trait required for loading Config from file
Additional requirents for CLI options to initialize the logging subsystem
Trait required for loading CLI options
Run an Application