Skip to content

Conversation

@tekktrik
Copy link
Member

@tekktrik tekktrik commented Jul 6, 2022

Fixes #33 by:

  • Adding StreamHandler as handler to new Logger instances using getLogger() by default
  • Adds \n to StreamHandler.emit() so log lines are seperated onto newlines

@tekktrik tekktrik requested a review from a team July 6, 2022 15:10
@tekktrik
Copy link
Member Author

tekktrik commented Jul 6, 2022

After this it may be worth removing the manual adding of StreamHandler instances across the library, in case loggers are ever able to hold more than one handler.

@tekktrik
Copy link
Member Author

tekktrik commented Jul 6, 2022

@Neradoc let me know if this solution works for your use/test cases

Copy link
Contributor

@FoamyGuy FoamyGuy left a comment

Choose a reason for hiding this comment

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

Looks good to me. Tested successfully on Feather ESP32 S2 TFT.

Adafruit CircuitPython 8.0.0-alpha.1-30-g8814ee03f-dirty on 2022-07-01; Adafruit Feather ESP32-S2 TFT with ESP32S2
>>> 
>>> import adafruit_logging as logging
>>> logger = logging.getLogger('test')
>>> logger.error('Error message')
1295.777: ERROR - Error message
>>> 

Thanks for the fix @tekktrik and reporting the issue @Neradoc

@FoamyGuy FoamyGuy merged commit 047df8f into adafruit:main Jul 9, 2022
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Jul 10, 2022
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.

Logging to the REPL

2 participants