Skip to content

pyDKB: improve logging system.#274

Merged
mgolosova merged 16 commits into
masterfrom
pyDKB-loggable-object
Sep 16, 2019
Merged

pyDKB: improve logging system.#274
mgolosova merged 16 commits into
masterfrom
pyDKB-loggable-object

Conversation

@mgolosova

@mgolosova mgolosova commented Jul 3, 2019

Copy link
Copy Markdown
Collaborator

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
Comment thread Utils/Dataflow/pyDKB/common/misc.py Outdated
Comment thread Utils/Dataflow/pyDKB/common/misc.py Outdated
@mgolosova

Copy link
Copy Markdown
Collaborator Author

Bugs fixed, please re-review the PR.

Comment thread Utils/Dataflow/pyDKB/common/types.py Outdated
Comment thread Utils/Dataflow/pyDKB/common/misc.py
@Evildoor

Evildoor commented Aug 7, 2019

Copy link
Copy Markdown
Contributor

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

Comment thread Utils/Dataflow/pyDKB/common/misc.py
Comment thread Utils/Dataflow/pyDKB/common/misc.py
Comment thread Utils/Dataflow/pyDKB/common/misc.py Outdated
Comment thread Utils/Dataflow/pyDKB/common/misc.py Outdated
Comment thread Utils/Dataflow/pyDKB/common/misc.py
Comment thread Utils/Dataflow/pyDKB/common/misc.py Outdated
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

@Evildoor Evildoor left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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