Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

global flags for verbose and debug modes? #848

Closed
hjoliver opened this issue Jan 13, 2014 · 5 comments · Fixed by #860
Closed

global flags for verbose and debug modes? #848

hjoliver opened this issue Jan 13, 2014 · 5 comments · Fixed by #860
Assignees
Milestone

Comments

@hjoliver
Copy link
Member

Currently verbose and debug modes are set by command line flags passed around via function argument lists. This is awkward because these flags are potentially wanted in every source file, and it creates a problem inside functions that have not been passed the flag (and may be several levels down the call stack). It seems to me that setting new global flags in lib/cylc/flags.py would be better way to do this, and a simple change to make.

@matthewrmshin - do you agree (or perhaps have a better suggestion?)?

@matthewrmshin
Copy link
Contributor

Do we currently use these options to configure the logger? I am be thinking in a naive way, but can we not simply use the logger to print extra diagnostic messages at higher verbosity levels?

@hjoliver
Copy link
Member Author

Yes and no. Verbose mode causes extra user-relevant information to be printed to stdout, but directly, not via the logger. Debug mode changes the logger level, and (I think) it may also print extra information to stdout or stderr. It would be nice to handle all output via the logger, but in the early days I couldn't get the standard lib logger to do everything that I wanted it to do (how's it done in Rose - have you rolled your own logger?).

So for the moment - at least until #386 is addressed - we potentially need access to the debug and verbose mode flags in every source file.

@matthewrmshin
Copy link
Contributor

how's it done in Rose - have you rolled your own logger?

Yes. See rose.reporter. Right at the start, we have decided that the standard logger does not do what we want (and is far too complex), so we have written something fairly simple (but flexible enough) to do what we want to do.

@matthewrmshin
Copy link
Contributor

(Cylc is slightly different to Rose, because the core of Cylc is the cylc run daemon, so the logger model should work slightly better. Most Rose CLI utilities have no access to a log file, so the logger model does not work at all.)

@hjoliver
Copy link
Member Author

Indeed.

My original intention (pre daemon mode and run db, of course) was to have useful info for users printed to stdout, and the log was meant to function loosely as the run db does (a lot better!) now. But, as I recall, the std logger can't be configured to print just 'normal' priority messages to stdout ... hence the current separate use of stdout/stderr and the logger.

So ... does this proposal seem a reasonable improvement to the status quo, subject to possible complete overhaul in the future for #386.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants