Skip to content

Logging Consideration #32

Open
Open

Description

@krowvin

CWMS-Batch (the run env), cwms-python, and cwms-cli have made use of the logging that python offers.

Print does work to get stdout onto the page.

But I would consider agreeing on a repo-wide logging structure. When the time comes if cwms-cli, or other such libraries, were to use regi-python it would offer them the ability to control the log level. The idea that we would be running these in dev, test, and production environments. Where we might only want a critical log level for prod.

The idea that if a user or cwms-cli were to adopt these, they would be able to set the log level and regi-python would respect that.

Thoughts on changing print() to logging.info/etc and adding debug options?

Would like to discuss this on August 27th meeting.

Activity

  1. added
    discussionLets talk about it, don't take action until a decision is reached.
    on Aug 21, 2026
  2. adamkorynta commented on Aug 21, 2026

    @adamkorynta
    Member

    I did swap the REGI Headless java logging to instead route through the python logging exactly for this case. It does a best attempt to translate python log levels to Java log levels to control debug, etc.

    See:
    https://github.com/USACE-WaterManagement/regi-python/blob/main/regi-headless/src/main/python/regi_python/regi_python_logging.py
    and
    https://github.com/USACE-WaterManagement/regi-python/blob/main/regi-headless/src/main/java/usace/rowcps/headless/PythonJulHandler.java

  3. krowvin commented on Aug 21, 2026

    @krowvin
    ContributorAuthor

    Ah very good. In that case users adopting the example scripts might want to change their print to logging.

    But we might also consider updating the examples themselves to the new log structure too.

    Food for thought!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionLets talk about it, don't take action until a decision is reached.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions