mirror of
https://github.com/eclipse-mosquitto/mosquitto.git
synced 2026-04-17 13:05:13 +02:00
Add -q option to mosquitto
This commit is contained in:
parent
6a641c9c0a
commit
1a8e416b17
|
|
@ -73,6 +73,7 @@ Broker:
|
|||
- TLS v1.1 now not enabled by default. It is still possible to explicitly
|
||||
choose TLS v1.1, but this is not recommended and will be removed in a future
|
||||
version.
|
||||
- Add -q option to allow logging to be disabled at the command line.
|
||||
|
||||
Plugins / plugin interface:
|
||||
- Add support for modifying outgoing messages using MOSQ_EVT_MESSAGE_OUT.
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
<arg choice='plain'>--daemon</arg>
|
||||
</group>
|
||||
<arg>-p <replaceable>port number</replaceable></arg>
|
||||
<arg>-q</arg>
|
||||
<arg>-v</arg>
|
||||
<arg>--tls-keylog <replaceable>file</replaceable></arg>
|
||||
</cmdsynopsis>
|
||||
|
|
@ -68,6 +69,18 @@
|
|||
file, then the <option>-p</option> options are IGNORED.</para></important>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>-q</option></term>
|
||||
<term><option>--quiet</option></term>
|
||||
<listitem>
|
||||
<para>Disable all logging. This is equivalent to setting
|
||||
<option>log_type</option> to <option>none</option> in
|
||||
the configuration file. This overrides any logging
|
||||
options given in the configuration file and also
|
||||
overrides <option>--verbose</option>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>--tls-keylog</option> <replaceable>file</replaceable></term>
|
||||
<listitem>
|
||||
|
|
@ -91,7 +104,7 @@
|
|||
<listitem>
|
||||
<para>Use verbose logging. This is equivalent to setting
|
||||
<option>log_type</option> to <option>all</option> in
|
||||
the configuration file. This overrides and logging
|
||||
the configuration file. This overrides any logging
|
||||
options given in the configuration file.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
|
|
|||
16
src/conf.c
16
src/conf.c
|
|
@ -274,7 +274,9 @@ static void config__init_reload(struct mosquitto__config *config)
|
|||
#else
|
||||
config->log_facility = LOG_DAEMON;
|
||||
config->log_dest = MQTT3_LOG_STDERR | MQTT3_LOG_DLT;
|
||||
if(db.verbose){
|
||||
if(db.quiet){
|
||||
config->log_type = 0;
|
||||
}else if(db.verbose){
|
||||
config->log_type = UINT_MAX;
|
||||
}else{
|
||||
config->log_type = MOSQ_LOG_ERR | MOSQ_LOG_WARNING | MOSQ_LOG_NOTICE | MOSQ_LOG_INFO;
|
||||
|
|
@ -490,6 +492,8 @@ static void print_usage(void)
|
|||
printf(" -h : display this help.\n");
|
||||
printf(" -p : start the broker listening on the specified port.\n");
|
||||
printf(" Not recommended in conjunction with the -c option.\n");
|
||||
printf(" -q : quiet mode - disable all logging types. This overrides\n");
|
||||
printf(" any logging options given in the config file, and -v.\n");
|
||||
printf(" -v : verbose mode - enable all logging types. This overrides\n");
|
||||
printf(" any logging options given in the config file.\n");
|
||||
printf(" --test-config : test config file and exit\n");
|
||||
|
|
@ -558,6 +562,8 @@ int config__parse_args(struct mosquitto__config *config, int argc, char *argv[])
|
|||
fprintf(stderr, "Error: TLS support not available so --tls-keylog is not available.\n");
|
||||
return MOSQ_ERR_INVAL;
|
||||
#endif
|
||||
}else if(!strcmp(argv[i], "-q") || !strcmp(argv[i], "--quiet")){
|
||||
db.quiet = true;
|
||||
}else if(!strcmp(argv[i], "-v") || !strcmp(argv[i], "--verbose")){
|
||||
db.verbose = true;
|
||||
}else if(!strcmp(argv[i], "--test-config")){
|
||||
|
|
@ -576,7 +582,9 @@ int config__parse_args(struct mosquitto__config *config, int argc, char *argv[])
|
|||
return MOSQ_ERR_NOMEM;
|
||||
}
|
||||
}
|
||||
if(db.verbose){
|
||||
if(db.quiet){
|
||||
config->log_type = 0;
|
||||
}else if(db.verbose){
|
||||
config->log_type = UINT_MAX;
|
||||
}
|
||||
|
||||
|
|
@ -791,7 +799,9 @@ int config__read(struct mosquitto__config *config, bool reload)
|
|||
if(cr.log_dest_set){
|
||||
config->log_dest = cr.log_dest;
|
||||
}
|
||||
if(db.verbose){
|
||||
if(db.quiet){
|
||||
config->log_type = 0;
|
||||
}else if(db.verbose){
|
||||
config->log_type = UINT_MAX;
|
||||
}else if(cr.log_type_set){
|
||||
config->log_type = cr.log_type;
|
||||
|
|
|
|||
|
|
@ -490,6 +490,7 @@ struct mosquitto_db{
|
|||
unsigned long msg_store_bytes;
|
||||
char *config_file;
|
||||
struct mosquitto__config *config;
|
||||
bool quiet;
|
||||
bool verbose;
|
||||
#ifdef WITH_SYS_TREE
|
||||
int subscription_count;
|
||||
|
|
|
|||
Loading…
Reference in a new issue