Evo command-line and misc helper tools.
More...
Evo command-line and misc helper tools.
◆ EVO_CORTEX_DYNAMIC_CAST
#define EVO_CORTEX_DYNAMIC_CAST 1 |
Set whether Cortex uses dynamic_cast
.
- This defaults to 1, to use
static_cast
instead define EVO_CORTEX_DYNAMIC_CAST 0
(before including cortex.h)
- Caution:
static_cast
does not do runtime checks and may be considered more dangerous, though dynamic_cast
doesn't catch all invalid casts either
◆ CommandLine
Process command-line arguments.
◆ CortexModulePtr
◆ ProcessId
◆ LogLevel
Log severity level used with Logger.
Enumerator |
---|
LOG_LEVEL_DISABLED | Logging disabled.
|
LOG_LEVEL_ALERT | Alert message for critical alert that needs immediate attention, program may be unstable (ALRT )
|
LOG_LEVEL_ERROR | Error message showing something isn't working as expected, program may be able to work around it (ERRR )
|
LOG_LEVEL_WARN | Warning message that can indicate a potential issue, this may lead to an error or alert (WARN )
|
LOG_LEVEL_INFO | Informational message for showing notices and context (INFO )
|
LOG_LEVEL_DEBUG | High-level debug message, used for showing debug info for higher-level behavior (DBUG )
|
LOG_LEVEL_DEBUG_LOW | Low-level debug message, used for showing debug info for lower-level internal or library details (DBGL )
|
◆ daemonize()
bool evo::daemonize |
( |
uint |
flags = 0 | ) |
|
|
inline |
Daemonize current process to run in background as a service (Linux/Unix).
- #include <evo/process.h>
- This writes errors to
syslog
by default, or writes errors to stderr
if flags & DAEMONIZE_USE_STDERR
- This is useful when
stderr
has been redirected to a log file
- By default, this never returns on error and instead does
exit(1)
on error, unless flags & DAEMONIZE_NO_EXIT
- Not supported in Windows
- Parameters
-
flags | Flags combined with bitwise OR :
DAEMONIZE_NO_CD to skip changing current directory to /
DAEMONIZE_NO_REDIR to skip redirecting std in/out/err to /dev/null
DAEMONIZE_NO_EXIT to skip exit() on error and return false instead
DAEMONIZE_USE_STDERR to use stderr instead of syslog for error messages, and not redirect stderr if flags & DAEMONIZE_NO_REDIR
|
- Returns
- Whether successful, false on error if
flags & DAEMONIZE_NO_EXIT
, otherwise on error this calls exit(1)
and never returns
◆ get_pid()
Get current process ID.
- Returns
- Current process ID
◆ DAEMONIZE_NO_CD
const uint DAEMONIZE_NO_CD = 0x01 |
|
static |
Flag to skip changing current directory – see daemonize()
◆ DAEMONIZE_NO_EXIT
const uint DAEMONIZE_NO_EXIT = 0x04 |
|
static |
Flag to return false on error instead of calling exit(1)
– see daemonize()
◆ DAEMONIZE_NO_REDIR
const uint DAEMONIZE_NO_REDIR = 0x02 |
|
static |
Flag to skip std in/out/err redirects – see daemonize()
◆ DAEMONIZE_USE_STDERR
const uint DAEMONIZE_USE_STDERR = 0x08 |
|
static |
Flag to use stderr
instead of syslog
for writing errors – see daemonize()
◆ LOG_LEVEL_REMAP