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

Add logging #35

Open
lmmx opened this issue Aug 10, 2021 · 1 comment
Open

Add logging #35

lmmx opened this issue Aug 10, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@lmmx
Copy link
Owner

lmmx commented Aug 10, 2021

This library could use logging, especially for some of the codecs like PNG where the order of execution is variable depending on the file (e.g. ZIP is more straightforward and standardised)

Not urgent (did not have a clear view of how much logging to do at the start) but currently using print statements where logging to console would be preferable.

Also would serve as a form of documentation on the order of execution/program structure for others wanting to use/develop on the library.

@lmmx lmmx added the enhancement New feature or request label Aug 10, 2021
@lmmx
Copy link
Owner Author

lmmx commented Aug 11, 2021

Implemented some (not very detailed)

import logging
__all__ = ["log", "set_up_logging"]
log = logging.getLogger() # Provided for ease of access in other modules
def set_up_logging(quiet: bool = True):
"""
Initialise the log
Args:
quiet : Change this flag to True/False to turn off/on console logging
"""
log.setLevel(logging.DEBUG)
log_format = logging.Formatter("[%(asctime)s] [%(levelname)s] - %(message)s")
if not quiet:
console = logging.StreamHandler()
console.setLevel(logging.DEBUG)
console.setFormatter(log_format)
log.addHandler(console)

used in the async utils (because the async stochastic firing off of requests makes logging important)

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

No branches or pull requests

1 participant