Feature #2347

Add support for standard logging module

Added by Zach Welch almost 3 years ago. Updated over 2 years ago.

Status:In Progress Start date:02/24/2015
Priority:Normal Due date:
Assignee:Zach Welch % Done:

90%

Category:-
Target version:0.5.0
Chirp Version:daily Model affected:(All models)

Description

In order to support a CLI (see issue #2343), the level of output needs to be variable, from terse to verbose. The proper solution will be to use the standard Python logging module. All existing print statements need to be reviewed, as most will need to be converted to use a logging call.

I have patches in hand that get this process started. The first adds a custom logger module and command line options for controlling it from the chirp.py CLI. The second adds all existing debug statements (controlled via CHIRP_DEBUG) to use it. The last converts a handful of other message to use it as well, making the CLI usable.

Additional patches will be required to convert other print statements and to add equivalent option parsing to the GUI.

Associated revisions

Revision 2380:5916e6603692
Added by Zach Welch over 2 years ago

Add chirp.logger module (#2347)

This patch adds the chirp.logger module, using it in chirpc and chirpw.
It adds a handful of optional command line arguments to control the new
logging features. In addition, CHIRP_DEBUG, CHIRP_LOG, and
CHIRP_LOG_LEVEL can be used to control the logging features from the
environment.

It also makes the version string reusable between the GUI and CLI, and
it prints that string at the start of the log file (if in use).

Revision 2382:93add44b17cb
Added by Dan Smith over 2 years ago

Revert r2380 since it removed logging the current version.

Related to #2347

Revision 2384:25e2d32b22bf
Added by Zach Welch over 2 years ago

Fix chirp.logger module (#2347)

This patch addresses some issues with the chirp.logger module in order
to use it in chirpc and chirpw. It prints the version string when
logging at DEBUG level.

In addition, it embraces and extends the "debug.log" support that was
present in chirpw, ensuring all log messages and output end up in that
file when running on Win32 or MacOS hosts. It also allows that feature
to be tested on Linux by setting CHIRP_DEBUG_LOG in the environment.

Revision 2385:2d3761d66f40
Added by Zach Welch over 2 years ago

Use new logger module (#2347)

This patch chases down all references to CHIRP_DEBUG, converting the
wrapped print calls to LOG.debug calls. It also eliminates a few plain
DEBUG variables and a couple of other one-off variants.

Revision 2386:dd0457a15257
Added by Zach Welch over 2 years ago

Suppress startup debugging messages (#2347)

This patch changes the verbose startup messages to use LOG.info calls.
This change is required to make the CLI remotely usable, as it's
unreasonable to print so much information in that context.

I kept this separate from the last patch, because I can imagine that
this might impact the automated/buildbot testing. To avoid regressions,
the previous output can be generated by setting 'CHIRP_DEBUG=info' in the
environment.

Revision 2422:a1e57a6d6cf7
Added by Zach Welch over 2 years ago

Use logging in chirp[cw] (#2347)

Revision 2423:3086b1beb49d
Added by Zach Welch over 2 years ago

Use logging in chirp/*.py (#2347)

Revision 2424:32b4f136c955
Added by Zach Welch over 2 years ago

Use logging in chirpui/*.py (#2347)

Revision 2454:d65875e0a023
Added by K. Arvanitis over 2 years ago

Set scrollable property on main app notebook

This prevents the window from being automatically resized when multiple tabs
are simultaneously opened.

Bug #2347

Revision 2494:02237a30c67b
Added by Zach Welch over 2 years ago

Use logging in run_tests (#2347)

We need to use logging in run_tests, if only to catch the new output
being generated by the drivers. This patch captures a debug.log for the
entire test run while squelching output on the console. The prevents
spurious error messages from being displayed. This may be improved upon
in subsequent patches, but this is necessary to prevent anyone from
seeing confusing output when running the tests.

Revision 2495:d457b32627d0
Added by Zach Welch over 2 years ago

Use logging in mainapp.py (#2347)

Revision 2496:6dba99c766e2
Added by Zach Welch over 2 years ago

Use logging in yaeosu_clone.py (#2347)

Revision 2497:23b7883f5c95
Added by Zach Welch over 2 years ago

Use logging in wouxun*.py (#2347)

Revision 2498:2a71809ec846
Added by Zach Welch over 2 years ago

Use logging in vx*.py (#2347)

Revision 2499:abf1e0a4fa3f
Added by Zach Welch over 2 years ago

Use logging in uv*.py (#2347)

Revision 2500:5bb491a276d5
Added by Zach Welch over 2 years ago

Use logging in drivers/t*.py (#2347)

Revision 2501:36be92e1889d
Added by Zach Welch over 2 years ago

Use logging in rfinder.py (#2347)

Revision 2502:e8e46d779397
Added by Zach Welch over 2 years ago

Use logging in drivers/[lp]*.py (#2347)

Revision 2503:37812053ea49
Added by Zach Welch over 2 years ago

Use logging in kenwood*.py (#2347)

Revision 2504:17a64f09e1fc
Added by Zach Welch over 2 years ago

Use logging in drivers/k*.py (#2347)

Revision 2505:b08fe6c29a4a
Added by Zach Welch over 2 years ago

Use logging in idrp.py (#2347)

Revision 2506:01b11916c2eb
Added by Zach Welch over 2 years ago

Use logging in ic9x*.py (#2347)

Revision 2507:a946593eed37
Added by Zach Welch over 2 years ago

Use logging in icf.py (#2347)

Revision 2508:0bae5dded46a
Added by Zach Welch over 2 years ago

Use logging in drivers/ft*.py (#2347)

Revision 2509:d1b2fd18bde9
Added by Zach Welch over 2 years ago

Use logging in drivers/[ab]*.py (#2347)

Revision 2510:0eb1da32d4a7
Added by Zach Welch over 2 years ago

Use logging in drivers/[hi]*.py (#2347)

Revision 2512:f8e79e2ada66
Added by Zach Welch over 2 years ago

Expose console verbosity (#2347)

This patch adds a method to query the console verbosity level. This is
useful for code that needs to produce non-logging output, conditional on
whether the --quiet or --verbose options were given.

Revision 2532:d0afd97ebb04
Added by Dan Smith over 2 years ago

Fix minor bugs in run_tests (#2343, #2347)

This patch contains two fixes for the run_tests.

The first change resolves problems when running the script without a
path component in its name (either as 'python run_tests' or with
PATH="./tests:${PATH}"). Now, we do not try to change directory unless
there is a path component.

The second problem was that the logs directory will not exist in a clean
working copy of the repository. It was being created after the logger
module was called. That is resolved by moving the directory creation
step to occur before the initialization of the logger module options.

Patch originally by Zach Welch, fixed instead of arguing by me.

History

Updated by Zach Welch over 2 years ago

  • Status changed from New to In Progress
  • % Done changed from 50 to 90

All of the existing print calls have been converted to logging calls. Some may still need to be tweaked (e.g. changed to different logging levels) and more likely need to be added.

Also available in: Atom PDF