+Do the replacement at code, docs and unit tests.
+Add a help message that's printed whenever there's an error at the configuration arguments.
+Fix a broken unit test.
+Fix the description of 'validation-log.tag'.
+Fix some errors at configuration examples ('examples/config.json') and at the web docs ('usage.html#--configuration-file').
url-log-color-output: "[`--log.color-output`](usage.html#--logcolor-output)"
url-log-file-name-format: "[`--log.file-name-format`](usage.html#--logfile-name-format)"
url-log-facility: "[`--log.facility`](usage.html#--logfacility)"
-url-log-prefix: "[`--log.prefix`](usage.html#--logprefix)"
+url-log-tag: "[`--log.tag`](usage.html#--logtag)"
url-vlog-enabled: "[`--validation-log.enabled`](usage.html#--validation-logenabled)"
url-vlog-level: "[`--validation-log.level`](usage.html#--validation-loglevel)"
url-vlog-output: "[`--validation-log.output`](usage.html#--validation-logoutput)"
url-vlog-color-output: "[`--validation-log.color-output`](usage.html#--validation-logcolor-output)"
url-vlog-file-name-format: "[`--validation-log.file-name-format`](usage.html#--validation-logfile-name-format)"
url-vlog-facility: "[`--validation-log.facility`](usage.html#--validation-logfacility)"
-url-vlog-prefix: "[`--validation-log.prefix`](usage.html#--validation-logprefix)"
+url-vlog-tag: "[`--validation-log.tag`](usage.html#--validation-logtag)"
---
# {{ page.title }}
4. [Color output](#color-output)
5. [File name format](#file-name-format)
6. [Facility](#facility)
- 7. [Prefix](#prefix)
+ 7. [Tag](#tag)
## Log types
- [`color-output`](#color-output)
- [`file-name-format`](#file-name-format)
- [`facility`](#facility)
-- [`prefix`](#prefix)
+- [`tag`](#tag)
-For instance, to enable the validation log the argument {{ page.url-vlog-enabled }} should be used (prefix: `validation-log.`, suffix: `enabled`).
+For instance, to enable the "validation log", the argument {{ page.url-vlog-enabled }} should be used (prefix: `validation-log.`, suffix: `enabled`).
The following sub-sections describe how each argument works.
- {{ page.url-log-facility }}
- {{ page.url-vlog-facility }}
-### Prefix
+### Tag
-Text prefix that will be added to each message of the corresponding log type. The prefix will be added after the message level, inside square brackets.
+Text tag that will be added to each message of the corresponding log type. The tag will be added after the message level, inside square brackets.
It's a simple mean to differentiate each message according to its type, probably useful if the [`*.output`](#output) is the same for both log types.
E.g. If a validation error is found, it could be logged like this:
{% highlight bash %}
-$ {{ page.command }} --validation-log.prefix="Validation" (...)
+$ {{ page.command }} --validation-log.tag="Validation" (...)
ERR [Validation]: rsync://rpki.example.com/foo/bar/baz.cer: Certificate validation failed: certificate has expired
{% endhighlight %}
The arguments of each log type are:
-- {{ page.url-log-prefix }}
-- {{ page.url-vlog-prefix }}
+- {{ page.url-log-tag }}
+- {{ page.url-vlog-tag }}
22. [`--log.color-output`](#--logcolor-output)
23. [`--log.file-name-format`](#--logfile-name-format)
24. [`--log.facility`](#--logfacility)
- 25. [`--log.prefix`](#--logprefix)
+ 25. [`--log.tag`](#--logtag)
26. [`--validation-log.enabled`](#--validation-logenabled)
27. [`--validation-log.level`](#--validation-loglevel)
28. [`--validation-log.output`](#--validation-logoutput)
29. [`--validation-log.color-output`](#--validation-logcolor-output)
30. [`--validation-log.file-name-format`](#--validation-logfile-name-format)
31. [`--validation-log.facility`](#--validation-logfacility)
- 32. [`--validation-log.prefix`](#--validation-logprefix)
+ 32. [`--validation-log.tag`](#--validation-logtag)
33. [`--http.user-agent`](#--httpuser-agent)
34. [`--http.connect-timeout`](#--httpconnect-timeout)
35. [`--http.transfer-timeout`](#--httptransfer-timeout)
[--log.color-output]
[--log.file-name-format=global-url|local-path|file-name]
[--log.facility=auth|authpriv|cron|daemon|ftp|kern|lpr|mail|news|syslog|user|uucp|local0|local1|local2|local3|local4|local5|local6|local7]
- [--log.prefix=<string>]
+ [--log.tag=<string>]
[--validation-log.enabled=true|false]
[--validation-log.level=error|warning|info|debug]
[--validation-log.output=syslog|console]
[--validation-log.color-output]
[--validation-log.file-name-format=global-url|local-path|file-name]
[--validation-log.facility=auth|authpriv|cron|daemon|ftp|kern|lpr|mail|news|syslog|user|uucp|local0|local1|local2|local3|local4|local5|local6|local7]
- [--validation-log.prefix=<string>]
+ [--validation-log.tag=<string>]
[--rrdp.enabled=true|false]
[--rrdp.priority=<unsigned integer>]
[--rrdp.retry.count=<unsigned integer>]
Read more at [Logging](logging.html) and at [Logging > Configuration > Facility](logging.html#facility).
-### `--log.prefix`
+### `--log.tag`
- **Type:** String
- **Availability:** `argv` and JSON
- **Default:** `NULL`
-Text prefix that will be added to the operation log messages (it will appear inside square brackets).
+Text tag that will be added to the operation log messages (it will appear inside square brackets).
-Read more at [Logging](logging.html) and at [Logging > Configuration > Prefix](logging.html#prefix).
+Read more at [Logging](logging.html) and at [Logging > Configuration > Tag](logging.html#tag).
### `--validation-log.enabled`
Read more at [Logging](logging.html) and at [Logging > Configuration > Facility](logging.html#facility).
-### `--validation-log.prefix`
+### `--validation-log.tag`
- **Type:** String
- **Availability:** `argv` and JSON
- **Default:** `Validation`
-Text prefix that will be added to the validation log messages (it will appear inside square brackets).
+Text tag that will be added to the validation log messages (it will appear inside square brackets).
-Read more at [Logging](logging.html) and at [Logging > Configuration > Prefix](logging.html#prefix).
+Read more at [Logging](logging.html) and at [Logging > Configuration > Tag](logging.html#tag).
### `--http.user-agent`
},
"log": {
+ "<a href="#--logenabled">enabled</a>": true,
"<a href="#--loglevel">level</a>": "warning",
"<a href="#--logoutput">output</a>": "console",
"<a href="#--logcolor-output">color-output</a>": true,
- "<a href="#--logfile-name-format">file-name-format</a>": "file-name"
+ "<a href="#--logfile-name-format">file-name-format</a>": "file-name",
+ "<a href="#--logfacility">facility</a>": "daemon",
+ "<a href="#--logtag">tag</a>": "Operation"
+ },
+
+ "validation-log": {
+ "<a href="#--validation-logenabled">enabled</a>": false,
+ "<a href="#--validation-loglevel">level</a>": "warning",
+ "<a href="#--validation-logoutput">output</a>": "console",
+ "<a href="#--validation-logcolor-output">color-output</a>": true,
+ "<a href="#--validation-logfile-name-format">file-name-format</a>": "global-url",
+ "<a href="#--validation-logfacility">facility</a>": "daemon",
+ "<a href="#--validation-logtag">tag</a>": "Validation"
},
"http": {
},
"slurm": "/tmp/fort/",
"log": {
- "enable": true,
+ "enabled": true,
"level": "warning",
"output": "console",
"color-output": false,
"facility": "daemon"
},
"validation-log": {
- "enable": false,
+ "enabled": false,
"level": "warning",
"output": "console",
"color-output": false,
"file-name-format": "global-url",
"facility": "daemon",
- "prefix": "[Validation]"
+ "tag": "Validation"
},
"http": {
"user-agent": "fort/1.3.0",
.RE
.P
-.B \-\-log.prefix=\fISTRING\fR
+.B \-\-log.tag=\fISTRING\fR
.RS 4
-Text prefix that will be added to the operation log messages (it will appear
+Text tag that will be added to the operation log messages (it will appear
inside square brackets).
.P
By default, it has a NULL value.
.RE
.P
-.B \-\-validation-log.prefix=\fISTRING\fR
+.B \-\-validation-log.tag=\fISTRING\fR
.RS 4
-Text prefix that will be added to the validation log messages (it will appear
+Text tag that will be added to the validation log messages (it will appear
inside square brackets).
.P
By default, it has the value \fIValidation\fR.
"color-output": true,
"file-name-format": "local-path",
"facility": "daemon",
- "prefix": "Operation"
+ "tag": "Operation"
},
"validation-log": {
"enabled": false,
"color-output": true,
"file-name-format": "local-path",
"facility": "daemon",
- "prefix": "Validation"
+ "tag": "Validation"
},
"http": {
"user-agent": "fort/1.3.0",
struct {
/** Enables operation logs **/
bool enabled;
- /** Prefix to identify operation logs **/
- char *prefix;
+ /** String tag to identify operation logs **/
+ char *tag;
/** Print ANSI color codes? */
bool color;
/** Format in which file names will be printed. */
struct {
/** Enables validation Logs **/
bool enabled;
- /** Prefix to identify validation logs **/
- char *prefix;
+ /** String tag to identify validation logs **/
+ char *tag;
/** Print ANSI color codes? */
bool color;
/** Format in which file names will be printed. */
.doc = "Log level to print message of equal or higher importance",
}, {
.id = 4003,
- .name = "log.prefix",
+ .name = "log.tag",
.type = >_string,
- .offset = offsetof(struct rpki_config, log.prefix),
- .doc = "Prefix to identify operation logs",
+ .offset = offsetof(struct rpki_config, log.tag),
+ .doc = "Text tag to identify operation logs",
.arg_doc = "<string>",
}, {
.id = 4004,
.doc = "Log level to print message of equal or higher importance",
}, {
.id = 4013,
- .name = "validation-log.prefix",
+ .name = "validation-log.tag",
.type = >_string,
- .offset = offsetof(struct rpki_config, validation_log.prefix),
- .doc = "Prefix to identify operation logs",
+ .offset = offsetof(struct rpki_config, validation_log.tag),
+ .doc = "Text tag to identify validation logs",
.arg_doc = "<string>",
}, {
.id = 4014,
rpki_config.log.color = false;
rpki_config.log.filename_format = FNF_GLOBAL;
rpki_config.log.facility = LOG_DAEMON;
- rpki_config.log.prefix = NULL;
+ rpki_config.log.tag = NULL;
rpki_config.validation_log.enabled = false;
rpki_config.validation_log.output = CONSOLE;
rpki_config.validation_log.color = false;
rpki_config.validation_log.filename_format = FNF_GLOBAL;
rpki_config.validation_log.facility = LOG_DAEMON;
- rpki_config.validation_log.prefix = strdup("Validation");
- if (rpki_config.validation_log.prefix == NULL) {
+ rpki_config.validation_log.tag = strdup("Validation");
+ if (rpki_config.validation_log.tag == NULL) {
error = pr_enomem();
- goto revert_validation_log_prefix;
+ goto revert_validation_log_tag;
}
rpki_config.output.roa = NULL;
rpki_config.stale_repository_period = 43200; /* 12 hours */
return 0;
-revert_validation_log_prefix:
+revert_validation_log_tag:
free(rpki_config.http.user_agent);
revert_flat_array:
string_array_cleanup(&rpki_config.rsync.args.flat);
log_start();
end:
- if (error)
+ if (error) {
free_rpki_config();
- else
+ pr_op_err("Try '%s --usage' or '%s --help' for more information.",
+ program_name, program_name);
+ } else
print_config();
free(long_opts);
}
char const *
-config_get_op_log_prefix(void)
+config_get_op_log_tag(void)
{
- return rpki_config.log.prefix;
+ return rpki_config.log.tag;
}
bool
}
char const *
-config_get_val_log_prefix(void)
+config_get_val_log_tag(void)
{
- return rpki_config.validation_log.prefix;
+ return rpki_config.validation_log.tag;
}
bool
/* Logging getters */
bool config_get_op_log_enabled(void);
-char const * config_get_op_log_prefix(void);
+char const * config_get_op_log_tag(void);
bool config_get_op_log_color_output(void);
enum filename_format config_get_op_log_filename_format(void);
uint8_t config_get_op_log_level(void);
uint32_t config_get_op_log_facility(void);
bool config_get_val_log_enabled(void);
-char const * config_get_val_log_prefix(void);
+char const * config_get_val_log_tag(void);
bool config_get_val_log_color_output(void);
enum filename_format config_get_val_log_filename_format(void);
uint8_t config_get_val_log_level(void);
#define PR_OP_SIMPLE(level) \
do { \
va_list args; \
- char const *prefix = config_get_op_log_prefix(); \
+ char const *prefix = config_get_op_log_tag(); \
bool color = config_get_op_log_color_output(); \
int facility = config_get_op_log_facility(); \
\
#define PR_VAL_SIMPLE(level) \
do { \
va_list args; \
- char const *prefix = config_get_val_log_prefix(); \
+ char const *prefix = config_get_val_log_tag(); \
bool color = config_get_val_log_color_output(); \
int facility = config_get_val_log_facility(); \
\
return pr_errno(error, op_syslog_enabled,
op_fprintf_enabled, config_get_op_log_facility(),
config_get_op_log_color_output(),
- config_get_op_log_prefix());
+ config_get_op_log_tag());
}
int
return pr_errno(error, val_syslog_enabled,
val_fprintf_enabled, config_get_val_log_facility(),
config_get_val_log_color_output(),
- config_get_val_log_prefix());
+ config_get_val_log_tag());
}
static int
{
if (op_syslog_enabled)
pr_simple_syslog(LOG_ERR, config_get_op_log_facility(),
- config_get_op_log_prefix(), str);
+ config_get_op_log_tag(), str);
if (op_fprintf_enabled)
- __fprintf(LOG_ERR, config_get_op_log_prefix(),
+ __fprintf(LOG_ERR, config_get_op_log_tag(),
config_get_op_log_color_output(),
" - %s", str);
return 1;
{
if (val_syslog_enabled)
pr_simple_syslog(LOG_ERR, config_get_val_log_facility(),
- config_get_val_log_prefix(), str);
+ config_get_val_log_tag(), str);
if (val_fprintf_enabled)
- __fprintf(LOG_ERR, config_get_val_log_prefix(),
+ __fprintf(LOG_ERR, config_get_val_log_tag(),
config_get_val_log_color_output(),
" - %s", str);
return 1;
return crypto_err(log_op_crypto_error, op_fprintf_enabled,
op_syslog_enabled, config_get_op_log_color_output(),
- config_get_op_log_facility(), config_get_op_log_prefix());
+ config_get_op_log_facility(), config_get_op_log_tag());
}
/**
return crypto_err(log_val_crypto_error, val_fprintf_enabled,
val_syslog_enabled, config_get_val_log_color_output(),
- config_get_val_log_facility(), config_get_val_log_prefix());
+ config_get_val_log_facility(), config_get_val_log_tag());
}
/**
{
if (op_syslog_enabled)
pr_simple_syslog(LOG_ERR, config_get_op_log_facility(),
- config_get_op_log_prefix(), "Out of memory.");
+ config_get_op_log_tag(), "Out of memory.");
if (op_fprintf_enabled)
- __fprintf(LOG_ERR, config_get_op_log_prefix(),
+ __fprintf(LOG_ERR, config_get_op_log_tag(),
config_get_op_log_color_output(),
"Out of memory.\n");
return -ENOMEM;
}
char const *
-config_get_op_log_prefix(void)
+config_get_op_log_tag(void)
{
return NULL;
}
}
char const *
-config_get_val_log_prefix(void)
+config_get_val_log_tag(void)
{
return "VALIDATION";
}
}
int
-process_file_or_dir(char const *location, char const *file_ext,
+process_file_or_dir(char const *location, char const *file_ext, bool empty_err,
process_file_cb cb, void *arg)
{
return 0;