[dpdk-dev] [RFC 3/4] eal: add command line option to log output to stdout

Neil Horman nhorman at tuxdriver.com
Wed Aug 3 13:25:40 CEST 2016


On Tue, Aug 02, 2016 at 09:37:48PM +0100, Declan Doherty wrote:
> Adds new command line options which allows the user to stop
> application echoing log output to stdout, logs are still
> written to syslog.
> 
> Signed-off-by: Declan Doherty <declan.doherty at intel.com>
> ---
>  lib/librte_eal/common/eal_common_log.c     | 14 ++++++++++++++
>  lib/librte_eal/common/eal_common_options.c |  8 ++++++++
>  lib/librte_eal/common/eal_options.h        |  2 ++
>  lib/librte_eal/common/include/rte_log.h    | 15 +++++++++++++++
>  lib/librte_eal/linuxapp/eal/eal.c          |  1 +
>  lib/librte_eal/linuxapp/eal/eal_log.c      | 23 ++++++++++++++---------
>  6 files changed, 54 insertions(+), 9 deletions(-)
> 
> diff --git a/lib/librte_eal/common/eal_common_log.c b/lib/librte_eal/common/eal_common_log.c
> index 7916c78..8319823 100644
> --- a/lib/librte_eal/common/eal_common_log.c
> +++ b/lib/librte_eal/common/eal_common_log.c
> @@ -45,6 +45,7 @@
>  struct rte_logs rte_logs = {
>  	.type = ~0,
>  	.level = RTE_LOG_DEBUG,
> +	.silent = 1,
>  	.file = NULL,
>  };
>  
> @@ -102,6 +103,18 @@ rte_get_log_level(void)
>  	return rte_logs.level;
>  }
>  
> +void
> +rte_log_silence_stdout(void)
> +{
> +	rte_logs.silent = 0;
> +}
> +
> +int
> +rte_log_stdout(void)
> +{
> +	return rte_logs.silent;
Maybe you want to return !rte_logs.silent?  That way the sense of the actual
variable makes human readable sense.  i.e. currently rte_logs.silent is set to 1
if you want to print to stdout, which seems backwards

Neil



More information about the dev mailing list