Skip to content

Commit c4dd52f

Browse files
committed
tools: add --loglevel option
1 parent 77faca4 commit c4dd52f

File tree

16 files changed

+70
-10
lines changed

16 files changed

+70
-10
lines changed

doc/gromox-edb2mt.8

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ Show a diagnostic tree view of the source data as it is being read.
2424
.TP
2525
\fB\-x\fP \fImbid\fP
2626
Extract the given mailbox from the .edb file.
27+
.TP
28+
\fB\-\-loglevel\fP \fIn\fP Maximum verbosity of general logging (not connected
29+
to \fB\-p\fP, \fB\-t\fP or \fB\-v\fP). 1=crit, 2=error, 3=warn, 4=notice,
30+
5=info, 6=debug.
31+
.br
32+
Default: \fI4\fP (notice)
2733
.SH Obtaining edb files
2834
On the Exchange server, stop the service known as "Microsoft Exchange
2935
Information Store" (as reported in services.msc) or

doc/gromox-eml2mt.8

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ message. \fIn\fP is 1-based.
4848
Treat all file arguments as iCalendar input. This is the default if the program
4949
was invoked as gromox\-ical2mt.
5050
.TP
51+
\fB\-\-loglevel\fP \fIn\fP Maximum verbosity of general logging (not connected
52+
to \fB\-p\fP, \fB\-t\fP or \fB\-v\fP). 1=crit, 2=error, 3=warn, 4=notice,
53+
5=info, 6=debug.
54+
.br
55+
Default: \fI4\fP (notice)
56+
.TP
5157
\fB\-\-mail\fP
5258
Treat all file arguments as Internet Mail input. This is the default if the
5359
program was invoked as gromox\-eml2mt.

doc/gromox-exm2eml.8

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,11 @@ properties to stderr.
4545
\fB\-u\fP [\fIuser\fP]\fB@\fIdomin.example\fP
4646
Source mail store from which to load the message from. For the public folder of
4747
a domain, leave out the local part, i.e. use \fB@\fP\fIdomain.example\fP.
48+
.TP
49+
\fB\-\-loglevel\fP \fIn\fP Maximum verbosity of general logging (not connected
50+
to \fB\-p\fP, \fB\-t\fP or \fB\-v\fP). 1=crit, 2=error, 3=warn, 4=notice,
51+
5=info, 6=debug.
52+
.br
53+
Default: \fI4\fP (notice)
4854
.SH See also
4955
\fBgromox\fP(7), \fBgromox\-eml2mt\fP(8)

doc/gromox-kdb2mt.8

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ Show a diagnostic tree view of the source data as it is being read.
5252
Print message count progress while processing larger folders. This option has
5353
no effect if (the even more verbose) \fB\-t\fP option was used.
5454
.TP
55+
\fB\-\-loglevel\fP \fIn\fP Maximum verbosity of general logging (not connected
56+
to \fB\-p\fP, \fB\-t\fP or \fB\-v\fP). 1=crit, 2=error, 3=warn, 4=notice,
57+
5=info, 6=debug.
58+
.br
59+
Default: \fI4\fP (notice)
60+
.TP
5561
\fB\-\-user\-map\fP \fIfile\fP
5662
Use the given file to perform ACL mapping. See section "ACL Extraction" below
5763
for details.

doc/gromox-mt2exm.8

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ raise an error if a to-be-created folder already exists. This behavior can be
6161
turned off with \-x. This option can be thought of what mkdir's \-p option
6262
would do.
6363
.TP
64+
\fB\-\-loglevel\fP \fIn\fP Maximum verbosity of general logging (not connected
65+
to \fB\-p\fP, \fB\-t\fP or \fB\-v\fP). 1=crit, 2=error, 3=warn, 4=notice,
66+
5=info, 6=debug.
67+
.br
68+
Default: \fI4\fP (notice)
69+
.TP
6470
\fB\-\-skip\-notif\fP
6571
Skip emitting MAPI notifications (when \-D is used). This is for development
6672
only.

doc/gromox-oxm2mt.8

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ Show properties in detail (enhances \fB\-t\fP).
1919
.TP
2020
\fB\-t\fP
2121
Show a diagnostic tree view of the source data as it is being read.
22+
.TP
23+
\fB\-\-loglevel\fP \fIn\fP Maximum verbosity of general logging (not connected
24+
to \fB\-p\fP, \fB\-t\fP or \fB\-v\fP). 1=crit, 2=error, 3=warn, 4=notice,
25+
5=info, 6=debug.
26+
.br
27+
Default: \fI4\fP (notice)
2228
.SH Examples
2329
Import of a message to drafts:
2430
.PP

doc/gromox-pff2mt.8

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ to avoid polluting e.g. "QuickStep settings" (which may already have settings).
4545
\fB\-t\fP
4646
Show a diagnostic tree view of the source data as it is being read.
4747
.TP
48+
\fB\-\-loglevel\fP \fIn\fP Maximum verbosity of general logging (not connected
49+
to \fB\-p\fP, \fB\-t\fP or \fB\-v\fP). 1=crit, 2=error, 3=warn, 4=notice,
50+
5=info, 6=debug.
51+
.br
52+
Default: \fI4\fP (notice)
53+
.TP
4854
\fB\-\-with\-hidden\fP, \fB\-\-without\-hidden\fP
4955
This option controls the import of folders that have PR_ATTR_HIDDEN=1.
5056
.br

include/gromox/defs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ enum gx_loglevel {
5151
LV_NOTICE = 4,
5252
LV_INFO = 5,
5353
LV_DEBUG = 6,
54+
MLOG_DEFAULT_LEVEL = LV_NOTICE,
5455
};
5556

5657
enum {

lib/rfbl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: AGPL-3.0-or-later
2-
// SPDX-FileCopyrightText: 2021-2025 grommunio GmbH
2+
// SPDX-FileCopyrightText: 20212025 grommunio GmbH
33
// This file is part of Gromox.
44
#ifdef HAVE_CONFIG_H
55
# include "config.h"
@@ -87,7 +87,7 @@ class hxmc_deleter {
8787

8888
}
8989

90-
static unsigned int g_max_loglevel = LV_NOTICE;
90+
static unsigned int g_max_loglevel = MLOG_DEFAULT_LEVEL;
9191
static std::mutex g_log_mutex;
9292
static std::unique_ptr<FILE, file_deleter> g_logfp;
9393
static bool g_log_tty, g_log_syslog;

tools/edb2mt.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,15 @@ struct edb_folder {
8383

8484
}
8585

86-
static unsigned int g_list_mbox;
86+
static unsigned int g_list_mbox, g_mlog_level = MLOG_DEFAULT_LEVEL;
8787
static char *g_extract_mbox;
8888

8989
static constexpr HXoption g_options_table[] = {
9090
{nullptr, 'l', HXTYPE_NONE, &g_list_mbox, nullptr, nullptr, 0, "Show available mailboxes in database"},
9191
{nullptr, 'p', HXTYPE_NONE | HXOPT_INC, &g_show_props, nullptr, nullptr, 0, "Show properties in detail (if -t)"},
9292
{nullptr, 't', HXTYPE_NONE, &g_show_tree, nullptr, nullptr, 0, "Show tree-based analysis of the archive"},
9393
{nullptr, 'x', HXTYPE_STRING, &g_extract_mbox, nullptr, nullptr, 0, "Extract the given mailbox", "ID/RK/GUID"},
94+
{"loglevel", 0, HXTYPE_UINT, &g_mlog_level, {}, {}, {}, "Basic loglevel of the program", "N"},
9495
HXOPT_AUTOHELP,
9596
HXOPT_TABLEEND,
9697
};
@@ -676,6 +677,7 @@ int main(int argc, char **argv)
676677
return EXIT_FAILURE;
677678
}
678679
#endif
680+
mlog_init(nullptr, nullptr, g_mlog_level, nullptr);
679681
if (iconv_validate() != 0)
680682
return EXIT_FAILURE;
681683
textmaps_init(PKGDATADIR);

0 commit comments

Comments
 (0)