From: Thomas Monjalon <thomas.monjalon@6wind.com>
To: "Wiles, Keith" <keith.wiles@intel.com>
Cc: dev@dpdk.org
Subject: Re: [PATCH] log:Change magic number on RTE_LOG_LEVEL to a define
Date: Sun, 02 Aug 2015 22:44:39 +0200 [thread overview]
Message-ID: <4594355.leWO83I6KL@xps13> (raw)
In-Reply-To: <D1E3D2AE.25822%keith.wiles@intel.com>
2015-08-02 19:10, Wiles, Keith:
> On 8/2/15, 12:15 PM, "Thomas Monjalon" <thomas.monjalon@6wind.com> wrote:
> >2015-06-06 19:04, Keith Wiles:
> >> +# Log level use: RTE_LOG_XXX
> >> +# XXX = NOOP, EMERG, ALERT, CRIT, ERR, WARNING, NOTICE, INFO or DEBUG
> >> +# Look in rte_log.h for others if any.
> >> +#
> >
> >I think this comment is useless.
>
> I do not think the comment is useless as some may not understand what
> values the Log level can be set too in the future. Not commenting the
> change would be a problem IMO. This is also why the line was moved.
It is already documented in the API doc.
I agree having some comments in the config files would be convenient but:
- this one is 3 lines long
- currently comments are only used to separate sections
Maybe you can do a oneline:
# Minimum log level compiled: DEBUG, INFO, NOTICE, WARNING or ERR
I think it is important to tell it is a minimum log level, i.e. compiled logs.
And probably it is not needed to suggest a minimum level higher than ERR.
> >> +enum {
> >> + RTE_LOG_NOOP = 0, /**< Noop not used (zero entry) */
> >
> >NOOP is useless: EMERG may be = 1
>
> Does it really matter if I used RTE_LOG_NOOP, just to make sure someone
> did not try to use zero here. Instead of setting the RTE_LOG_EMERG=1, I
> can change it to be the way you suggest, but I think it does not hurt
> anything does it?
We avoid adding code without real use which could cause confusion.
> >> + RTE_LOG_EMERG, /**< System is unusable. */
> >> + RTE_LOG_ALERT, /**< Action must be taken immediately. */
> >> + RTE_LOG_CRIT, /**< Critical conditions. */
> >> + RTE_LOG_ERR, /**< Error conditions. */
> >> + RTE_LOG_WARNING, /**< Warning conditions. */
> >> + RTE_LOG_NOTICE, /**< Normal but significant condition. */
> >> + RTE_LOG_INFO, /**< Informational. */
> >> + RTE_LOG_DEBUG /**< Debug-level messages. */
> >> +};
> >
> >What is the benefit of this change?
>
> The change is to use a enum in place of using magic numbers, plus you get
> the benefit of seeing the enum name in the debugger instead of a number.
> It makes the code more readable IMHO.
OK so a comment in the commit message could give the debugger justification.
next prev parent reply other threads:[~2015-08-02 20:45 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-07 0:04 [PATCH] eal:Fix log messages always being printed from rte_eal_cpu_init Keith Wiles
2015-06-07 0:04 ` [PATCH] log:Change magic number on RTE_LOG_LEVEL to a define Keith Wiles
2015-08-02 17:15 ` Thomas Monjalon
2015-08-02 19:10 ` Wiles, Keith
2015-08-02 19:15 ` Wiles, Keith
2015-08-02 20:44 ` Thomas Monjalon [this message]
2015-08-02 20:58 ` Wiles, Keith
2015-08-02 21:22 ` Thomas Monjalon
2015-08-02 21:40 ` [PATCH v2] log:Change magic number on RTE_LOG_LEVEL to an enum name Keith Wiles
2015-08-03 3:13 ` Stephen Hemminger
2015-06-08 11:09 ` [PATCH] eal:Fix log messages always being printed from rte_eal_cpu_init Bruce Richardson
2015-06-08 13:33 ` Wiles, Keith
2015-06-08 13:59 ` Wiles, Keith
2015-06-08 21:55 ` [PATCH v2] " Keith Wiles
2015-06-19 9:54 ` David Marchand
2015-06-22 20:04 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4594355.leWO83I6KL@xps13 \
--to=thomas.monjalon@6wind.com \
--cc=dev@dpdk.org \
--cc=keith.wiles@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.