Only stream logging with debug level is enabled for now.
Details
Diff Detail
- Lint
Lint Skipped - Unit
Unit Tests Skipped
Other than the init issue and the potential conflicts with D5, it looks good to me. We'll need to file a task for actually configuring the logs in a sane way, but I see that as a bit out of scope for this change.
libtaskotron/__init__.py | ||
---|---|---|
4 ↗ | (On Diff #13) | In general, init on import is a bad idea. I think this should be initialized on startup of the runner instead. Explicit is better in this case and it'll be all the more important when we start shipping logs - it shouldn't try to connect to anything over the network until explicitly initialized |
libtaskotron/runner.py | ||
3 |
Agreed, configuring the logs will be done separately.
libtaskotron/__init__.py | ||
---|---|---|
4 ↗ | (On Diff #13) | Just a note, the init function will not change when we start shipping logs nor it will try to connect to anything over the network. logstash just scans whatever logging produces. Anyway, I am fine with putting init into the runner. |
libtaskotron/runner.py | ||
3 | Yeah, I was/am going to hold on with this until D5 is merged in develop. |
libtaskotron/__init__.py | ||
---|---|---|
4 ↗ | (On Diff #13) | How will it work when I use some libtaskotron module but don't run it through the runner (containing the init code)? Martin, please test. |
4 ↗ | (On Diff #13) | Do we want to default to DEBUG? It might be better to have a command line option for that a default to WARN or INFO? |
libtaskotron/file_utils.py | ||
77 | Let's change to logging.debug() | |
libtaskotron/logger.py | ||
37–38 | Can you add docstrings for the arguments? Not everyone knows what 'streaming' is, where does it stream to, and what kind of values filelog accepts - e.g. file names or handlers. Should filelog default to None instead? |
libtaskotron/__init__.py | ||
---|---|---|
4 ↗ | (On Diff #13) |
In that case, the output is muted. You need to run the init function in order to use logging.
Let's leave default to DEBUG for now for development purposes and change it along with adding command line/configuration options with sane defaults for another task. |
Kamil: I can't think of any use cases where we'd be using libtaskotron without the runner and didn't think it was a problem - did I miss a use case?
If not, it looks good to me
Kamil: I can't think of any use cases where we'd be using libtaskotron without the runner and didn't think it was a problem - did I miss a use case?
For example the upgradepath script, I want to be able to run it standalone, without the runner, like this:
$ ./upgradepath.py f20-updates
I'm using libtaskotron modules inside for koji and bodhi operations, for example.
If I need to call some special method to enable logging in those modules, that's fine for me (and I don't know what the usual approach is anyway). I was just worried whether it would crash or something.
Only the sys.excepthook needs to be changed I think, the rest of it are cosmetic issues.
libtaskotron/directives/koji_directive.py | ||
---|---|---|
83 | pylint says you can use comma instead of the percent sign, it could be a bit more efficient. this applies to everywhere else | |
libtaskotron/logger.py | ||
35 | The docs say you can use logger.exception() for this use case: Also, you should call this on 'log' variable instead of 'logging' module? | |
39 | I think this should go into init() (i.e. we run the program)? Otherwise we will override this setting for anyone using our library. | |
44 | I would default to name='libtaskotron' | |
libtaskotron/runner.py | ||
126 | libtaskotron.logger.init() would be clearer here |
pylint says you can use comma instead of the percent sign, it could be a bit more efficient. this applies to everywhere else