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

pyDKB: improve logging system. #274

Merged
merged 16 commits into from
Sep 16, 2019
Merged

pyDKB: improve logging system. #274

merged 16 commits into from
Sep 16, 2019

Conversation

mgolosova
Copy link
Collaborator

@mgolosova mgolosova commented Jul 3, 2019

While #135 is an attempt to do something more elegant, this PR simpy makes the code more DRY and improves log messages style.


(Waiting for: #273) (merged)

@mgolosova mgolosova requested a review from anastasiakaida July 3, 2019 11:52
@mgolosova mgolosova self-assigned this Jul 3, 2019
@mgolosova mgolosova changed the title pyDKB: Loggable Object [pending] pyDKB: Loggable Object Jul 3, 2019
@mgolosova mgolosova force-pushed the pyDKB-loggable-object branch from 588b5ff to a9da4f2 Compare July 9, 2019 12:35
This type (fixed set of service words) looks like the one that will be
used across the whole library, not in the `dataflow` module alone.
Now and then we need to output some log message from the module body,
not from an object (e.g. warn message about failed import). It does not
look good to write something like `LoggableObject.log(msg)`; simple
`log(msg)` looks better for me.
If used from `LoggableObject`, prefix is the caller class name (passed
via `LoggableObject.log` method). If no prefix passed, caller module
name is used instead.

`LoggableObject` method does not support additional prefixes, yet if
`log` function is called directly, prefixes can be passed and in this
case caller `__name__` should be passed explicitly.
@mgolosova mgolosova force-pushed the pyDKB-loggable-object branch from a9da4f2 to d3761de Compare July 10, 2019 11:46
@mgolosova mgolosova changed the title [pending] pyDKB: Loggable Object pyDKB: improve logging system. Jul 10, 2019
@mgolosova mgolosova force-pushed the pyDKB-loggable-object branch from bfc5767 to 82561c6 Compare July 10, 2019 12:06
@mgolosova mgolosova requested a review from Evildoor July 10, 2019 12:14
@mgolosova mgolosova force-pushed the pyDKB-loggable-object branch from 3e5fb3e to 97177b5 Compare July 10, 2019 12:25
anastasiakaida
anastasiakaida previously approved these changes Jul 31, 2019
@mgolosova
Copy link
Collaborator Author

Bugs fixed, please re-review the PR.

@Evildoor
Copy link
Contributor

Evildoor commented Aug 7, 2019

I have some other concerns regarding this PR and log system changes, but I'll voice them either on team meeting or through mail.

Now `log('')` and `log('\n\n\n')` output nothing and multiple newline
symbols are ignored:
```
>>> log('')
>>> log('\n\n\n\n')
>>>
>>> log('a\n\n\n\n')
2019-08-30 11:45:04 (INFO) (main) a
>>> log('a\n\n\nb\n')
2019-08-30 11:45:10 (INFO) (main) a
(==) b
>>> log(['a\n\n\nb\n', 'ccc', 'de\n\nf\n'])
2019-08-30 11:45:28 (INFO) (main) a
(==) b
(==) ccc
(==) de
(==) f
```
Evildoor
Evildoor previously approved these changes Sep 12, 2019
Copy link
Contributor

@Evildoor Evildoor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My comments were answered and I don't see anything else to comment on.

@mgolosova
Copy link
Collaborator Author

@Evildoor, I have just updated the pyDKB version info, since there were some changes added after the previous value (0.3.20190710) had been set.
Please, re-approve.

@Evildoor Evildoor mentioned this pull request Sep 16, 2019
@mgolosova mgolosova merged commit bf32d2a into master Sep 16, 2019
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 this pull request may close these issues.

3 participants