Skip to content
This repository was archived by the owner on Apr 24, 2022. It is now read-only.

Provide more granular control of logging options #1544

Merged
merged 6 commits into from
Sep 5, 2018
Merged

Conversation

jean-m-cyr
Copy link
Contributor

@jean-m-cyr jean-m-cyr commented Sep 5, 2018

The verbosity level was intended to indicate severity of
a log entry. Over time we've used it inappropriately to
enable various log options. This has led us to a situation
where it is impossible to enable some options without
also enabling others.

This changes the global verbosity setting to be a set of
bits, each indicating if a log feature is enabled.

The following choices are defined and spelled out in the
help.

#define LOG_SWITCH_TIME 1
#define LOG_JSON 2
#define LOG_PER_GPU 4
#define LOG_DEBUG 8

Any combination of the sum of these options (0-15) is allowed.

The verbosity level was intended to indicate severity of
a log entry. Over time we've used it inappropriately to
enable various log options. This has led us to a situation
where it is impossible to enable some options without
also enabling others.

This changes the global verbosity setting to be a set of
bits, each indicating if a log feature is enabled.

The following choices are defined and spelled out in the
help.

 #define LOG_SWITCH_TIME 1
 #define LOG_JSON 2
 #define LOG_PER_GPU 4
 #define LOG_DEBUG 8
libdevcore/Log.h Outdated
#define LOG_JSON 2
#define LOG_PER_GPU 4
#define LOG_DEBUG 8
extern int g_logOptions;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add
# define LOG_MAX (LOG_SWITCH_TIME|LOG_JSON|LOG_PER_GPU|LOG_DEBUG)

Copy link
Collaborator

@StefanOberhumer StefanOberhumer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use LOG_MAX to validate range also in ApiServer.cpp:

if (verbosity > 9)

@StefanOberhumer
Copy link
Collaborator

Document change in CHANGELOG.md

->group(CommonGroup)
->check(CLI::Range(9));
->check(CLI::Range(15));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use LOG_MAX to validate range

@StefanOberhumer StefanOberhumer merged commit 9512a52 into master Sep 5, 2018
@StefanOberhumer StefanOberhumer deleted the verbosity branch September 5, 2018 13:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants