VideoTools
|
A handy synthesis of G::LogOutput, G::GetOpt, G::Root, G::Daemon and G::PidFile, used to initialise a server process. More...
#include <gvstartup.h>
Public Member Functions | |
Startup (const G::GetOpt &, const std::string &args_help, bool argc_ok, const std::string &extra_help=std::string()) | |
Constructor, typically used very early in main(). More... | |
void | start () |
Called just before the event loop. More... | |
void | report (const std::string &prefix, std::exception &e) |
Reports an error if start()ed and "daemon" or "syslog" are in effect. More... | |
void | report (const std::string &prefix, const std::string &what) |
Reports an error if start()ed and "daemon" or "syslog" are in effect. | |
Static Public Member Functions | |
static void | sanitise (int argc, char *argv[]) |
Removes sensitive information from the command-line, if possible. | |
A handy synthesis of G::LogOutput, G::GetOpt, G::Root, G::Daemon and G::PidFile, used to initialise a server process.
Definition at line 38 of file gvstartup.h.
Gv::Startup::Startup | ( | const G::GetOpt & | opt, |
const std::string & | args_help, | ||
bool | argc_ok, | ||
const std::string & | extra_help = std::string() |
||
) |
Constructor, typically used very early in main().
Parses the command-line and processes "--help" and "--version". Assumes there are options for "daemon", "user", "verbose", "debug", "log-time", "syslog" and "pid-file". Throws Gv::Exit for an immediate exit.
Definition at line 77 of file gvstartup.cpp.
void Gv::Startup::report | ( | const std::string & | prefix, |
std::exception & | e | ||
) |
Reports an error if start()ed and "daemon" or "syslog" are in effect.
This is useful for errors that would otherwise only go to stderr since stderr might be closed.
Definition at line 189 of file gvstartup.cpp.
void Gv::Startup::start | ( | ) |
Called just before the event loop.
This should be used after all non-event-driven initialisation has completed. The process forks and exits the parent, if required.
Definition at line 160 of file gvstartup.cpp.