tree-wide: Use log_setup() everywhere

Otherwise the default log target is the console and we won't use
the journal socket even if it is available.
This commit is contained in:
Daan De Meyer
2024-04-25 14:09:09 +02:00
parent d74ebb175a
commit aa976d8788
38 changed files with 43 additions and 99 deletions

View File

@@ -83,8 +83,7 @@ static int run(int argc, char *argv[]) {
/* This is mostly intended to be used for scripts which want
* to detect whether AC power is plugged in or not. */
log_parse_environment();
log_open();
log_setup();
r = parse_argv(argc, argv);
if (r <= 0)

View File

@@ -226,9 +226,7 @@ static int run(int argc, char *argv[]) {
usec_t timeout;
int r;
log_show_color(true);
log_parse_environment();
log_open();
log_setup();
r = parse_argv(argc, argv);
if (r <= 0)

View File

@@ -499,8 +499,7 @@ static int run(int argc, char *argv[]) {
int r;
log_parse_environment();
log_open();
log_setup();
r = parse_argv(argc, argv);
if (r <= 0)

View File

@@ -79,8 +79,7 @@ static int run(int argc, char *argv[]) {
uint32_t n;
int r;
log_parse_environment();
log_open();
log_setup();
r = parse_argv(argc, argv);
if (r <= 0)

View File

@@ -1160,9 +1160,7 @@ static int measure_main(int argc, char *argv[]) {
static int run(int argc, char *argv[]) {
int r;
log_show_color(true);
log_parse_environment();
log_open();
log_setup();
r = parse_argv(argc, argv);
if (r <= 0)

View File

@@ -797,9 +797,7 @@ static int run(int argc, char *argv[]) {
size_t vks;
int slot, slot_to_wipe, r;
log_show_color(true);
log_parse_environment();
log_open();
log_setup();
r = parse_argv(argc, argv);
if (r <= 0)

View File

@@ -84,8 +84,7 @@ static int load_and_print(void) {
static int run(int argc, char *argv[]) {
int r;
log_parse_environment();
log_open();
log_setup();
if (argc > 1)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "This program takes no arguments.");

View File

@@ -33,8 +33,7 @@ static inline void fuzz_setup_logging(void) {
* in a fuzzing mode, so disable most of the logging. */
log_set_assert_return_is_critical(true);
log_set_max_level(LOG_CRIT);
log_parse_environment();
log_open();
log_setup();
}
/* Force value to not be optimized away. */

View File

@@ -120,8 +120,7 @@ static int hwdb_main(int argc, char *argv[]) {
static int run(int argc, char *argv[]) {
int r;
log_parse_environment();
log_open();
log_setup();
r = parse_argv(argc, argv);
if (r <= 0)

View File

@@ -1070,8 +1070,7 @@ static int run(int argc, char **argv) {
_cleanup_free_ char *cert = NULL, *trust = NULL;
int r;
log_show_color(true);
log_parse_environment();
log_setup();
/* The journal merging logic potentially needs a lot of fds. */
(void) rlimit_nofile_bump(HIGH_RLIMIT_NOFILE);

View File

@@ -764,8 +764,7 @@ static int run(int argc, char **argv) {
bool use_journal;
int r;
log_show_color(true);
log_parse_environment();
log_setup();
/* The journal merging logic potentially needs a lot of fds. */
(void) rlimit_nofile_bump(HIGH_RLIMIT_NOFILE);

View File

@@ -305,8 +305,7 @@ static int run(int argc, char *argv[]) {
_cleanup_free_ char *message = NULL;
int r;
log_open();
log_parse_environment();
log_setup();
sigbus_install();

View File

@@ -257,9 +257,7 @@ static int run(int argc, char *argv[]) {
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
int r;
log_show_color(true);
log_parse_environment();
log_open();
log_setup();
r = parse_argv(argc, argv);
if (r <= 0)

View File

@@ -190,8 +190,7 @@ static int do_umount(const char *user) {
static int run(int argc, char *argv[]) {
int r;
log_parse_environment();
log_open();
log_setup();
if (argc != 3)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),

View File

@@ -139,8 +139,7 @@ static int run(int argc, char *argv[]) {
_cleanup_(umount_and_freep) char *mounted_dir = NULL;
int r;
log_parse_environment();
log_open();
log_setup();
r = parse_argv(argc, argv);
if (r <= 0)

View File

@@ -1492,9 +1492,7 @@ static int run(int argc, char* argv[]) {
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
int r;
log_show_color(true);
log_parse_environment();
log_open();
log_setup();
r = parse_argv(argc, argv);
if (r <= 0)

View File

@@ -5777,8 +5777,7 @@ static int run(int argc, char *argv[]) {
_cleanup_(fw_ctx_freep) FirewallContext *fw_ctx = NULL;
pid_t pid = 0;
log_parse_environment();
log_open();
log_setup();
arg_privileged = getuid() == 0;

View File

@@ -56,7 +56,7 @@ static int run(int argc, char *argv[]) {
int r;
log_set_max_level(LOG_DEBUG);
log_open();
log_setup();
r = userns_restrict_install(/* pin= */ false, &obj);
if (ERRNO_IS_NOT_SUPPORTED(r)) {

View File

@@ -119,9 +119,7 @@ static int run(int argc, char* argv[]) {
int r;
log_show_color(true);
log_parse_environment();
log_open();
log_setup();
r = parse_argv(argc, argv);
if (r <= 0)

View File

@@ -8005,9 +8005,7 @@ static int run(int argc, char *argv[]) {
bool node_is_our_loop = false;
int r;
log_show_color(true);
log_parse_environment();
log_open();
log_setup();
r = parse_argv(argc, argv);
if (r <= 0)

Some files were not shown because too many files have changed in this diff Show More