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

DISCUSSION: Logger .. test, ideas and incorporating a global logging class #14

Closed
carsten-forty2 opened this issue Jul 20, 2015 · 8 comments
Assignees
Milestone

Comments

@carsten-forty2
Copy link
Contributor

Several log levels would be nice: Quiet, Info, Debug, Insane, Warn, Error

ALL! output inside pygimli should write into the logger.

./appX --verbose should set the logger to 'Info'
./appX --debug should set pg.setDebug() and the logger to 'Debug'

-Quiet for default or gui mode, Warn=off, Error=on

-Insane only for internal use

Is there a way to extract the output from the logger for futher GUI usage?
Is it distinguishable between cout cerr?

check:
logging package

@florian-wagner
Copy link
Member

I like the idea 👍 The std logging module seems to provide everything required but is the C++ part able to talk to the logger?

@carsten-forty2
Copy link
Contributor Author

Agree https://docs.python.org/3/howto/logging.html#logging-basic-tutorial seems to be reliable for this task.

I let it open until I found a way to call this from the core, but we should start to use this logging instead of print() whenever possible.

@carsten-forty2 carsten-forty2 self-assigned this Oct 12, 2017
carsten-forty2 added a commit that referenced this issue Oct 12, 2017
…st playground in testing/test_logger.py. Still need some tuning and we should collect experience.
@carsten-forty2
Copy link
Contributor Author

made a little progress .. C++ part can now talk to the logger .. we now only need to define some defaults behavior

@halbmy
Copy link
Contributor

halbmy commented Oct 13, 2017

great!
will not void log(...) in gimli.cpp override override pg.log (logarithm)?

@carsten-forty2
Copy link
Contributor Author

carsten-forty2 commented Oct 13, 2017

hmm .. good point .. did not yet tested it but should be no problem since log(logging) needs two args (int, str) and log(logarithm) only can handle one arg (float|iterable)

carsten-forty2 added a commit that referenced this issue Oct 17, 2017
…st playground in testing/test_logger.py. Still need some tuning and we should collect experience.
@carsten-forty2
Copy link
Contributor Author

Add new tests and syntax suggestions .. still work in progress and discussion is appreciated.

import pygimli as pg
# library related logs with 
pg.logger.info(msg)
pg.logger.warn(msg)
# core related logs (should not used from python code
pg.log(Info, msg) 

See testing/test_logger.py for more examples.

@carsten-forty2 carsten-forty2 reopened this Jan 7, 2018
carsten-forty2 added a commit that referenced this issue Jan 7, 2018
@florian-wagner florian-wagner added this to the 1.1 milestone Jan 8, 2018
@carsten-forty2
Copy link
Contributor Author

carsten-forty2 commented Jan 26, 2018

new logger syntax to try .. less to type

pg.info(msg) pg.warn(msg) pg.error(msg) pg.debug(msg) pg.critical(msg)

@florian-wagner
Copy link
Member

Nice, this is handy and not more effort than a print statement. 👍

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

No branches or pull requests

3 participants