Skip to content
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.

Use fstring instead of multiple arg for logging and some refactoring #107

Merged
merged 2 commits into from
Oct 3, 2023

Conversation

smahmed776
Copy link
Member

The logging module expects a single parameter for all of its methods debug, error, and info. Thus converted all multi-params to fstring to fix the following error:

[2023-10-03 19:18:12] - flojoy - ERROR - not all arguments converted during string formatting
[2023-10-03 19:18:12] - flojoy - ERROR - error occured while running the node
[2023-10-03 19:18:12] - flojoy - DEBUG - Traceback (most recent call last):
  File "H:\flojoy\studio\venv\lib\site-packages\flojoy\flojoy_python.py", line 183, in wrapper
    logger.debug("previous jobs:", previous_jobs)
  File "F:\programs\Python\lib\logging\__init__.py", line 1465, in debug
    self._log(DEBUG, msg, args, **kwargs)
  File "F:\programs\Python\lib\logging\__init__.py", line 1624, in _log
    self.handle(record)
  File "F:\programs\Python\lib\logging\__init__.py", line 1634, in handle
    self.callHandlers(record)
  File "F:\programs\Python\lib\logging\__init__.py", line 1696, in callHandlers
    hdlr.handle(record)
  File "F:\programs\Python\lib\logging\__init__.py", line 968, in handle
    self.emit(record)
  File "H:\flojoy\studio\captain\utils\logger.py", line 51, in emit
    log_entry = self.format(record)
  File "F:\programs\Python\lib\logging\__init__.py", line 943, in format
    return fmt.format(record)
  File "F:\programs\Python\lib\logging\__init__.py", line 678, in format
    record.message = record.getMessage()
  File "F:\programs\Python\lib\logging\__init__.py", line 368, in getMessage
    msg = msg % self.args
TypeError: not all arguments converted during string formatting

@smahmed776 smahmed776 added the bug Something isn't working label Oct 3, 2023
@itsjoeoui itsjoeoui self-requested a review October 3, 2023 18:50
Copy link
Member

@itsjoeoui itsjoeoui left a comment

Choose a reason for hiding this comment

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

lgtm

@smahmed776 smahmed776 merged commit fb878d9 into develop Oct 3, 2023
3 checks passed
@smahmed776 smahmed776 deleted the mahbub/fix-logging branch October 3, 2023 23:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants