Run as a user. This is the opposite of \fB\-\-system\fR, and is the default if
not invoked as the root user.
.TP
+\fB\-q\fR, \fB\-\-quiet\fR
+Run with no output to the terminal/console. This disables service status messages
+and sets the log level for the console log to \fBNONE\fR.
+.TP
\fB\-\-help\fR
display this help and exit
.TP
extern eventloop_t event_loop;
static bool log_current_line[2]; // Whether the current line is being logged (for console, main log)
-loglevel_t log_level[2] = { loglevel_t::INFO, loglevel_t::WARN };
static bool log_format_syslog[2] = { false, true };
static service_set *services = nullptr; // Reference to service set
+loglevel_t log_level[2] = { loglevel_t::INFO, loglevel_t::WARN };
+bool console_service_status = true; // show service status messages to console?
+
dasynq::time_val release_time; // time the log was released
using rearm = dasynq::rearm;
// (One for main log, one for console)
static buffered_log_stream log_stream[2];
-constexpr static int DLOG_MAIN = 0; // main log facility
-constexpr static int DLOG_CONS = 1; // console
-
void buffered_log_stream::release_console()
{
if (release) {
template <typename ... T> static void do_log_cons(T ... args) noexcept
{
- log_current_line[DLOG_CONS] = true;
- log_current_line[DLOG_MAIN] = false;
- push_to_log(DLOG_CONS, args...);
+ if (console_service_status) {
+ log_current_line[DLOG_CONS] = true;
+ log_current_line[DLOG_MAIN] = false;
+ push_to_log(DLOG_CONS, args...);
+ }
}
// Log to the main facility at NOTICE level
return 1;
}
}
+ else if (strcmp(argv[i], "--quiet") == 0 || strcmp(argv[i], "-q") == 0) {
+ console_service_status = false;
+ log_level[DLOG_CONS] = loglevel_t::ZERO;
+ }
else if (strcmp(argv[i], "--help") == 0) {
cout << "dinit, an init with dependency management\n"
" --help display help\n"
" --user, -u run as a user service manager\n"
" --socket-path <path>, -p <path>\n"
" path to control socket\n"
+ " --quiet, -q disable output to standard output\n"
" <service-name> start service with name <service-name>\n";
return 0;
}
ZERO // log absolutely nothing
};
+constexpr static int DLOG_MAIN = 0; // main log facility
+constexpr static int DLOG_CONS = 1; // console
+
// These are defined in dinit-log.cc:
extern loglevel_t log_level[2];
+extern bool console_service_status; // show service status messages to console?
+
void enable_console_log(bool do_enable) noexcept;
void init_log(service_set *sset, bool syslog_format);
void setup_main_log(int fd);