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

Replace print with logging #1

Open
onkoe opened this issue Sep 20, 2023 · 1 comment
Open

Replace print with logging #1

onkoe opened this issue Sep 20, 2023 · 1 comment

Comments

@onkoe
Copy link
Member

onkoe commented Sep 20, 2023

Currently, we use print to debug our programs. We shouldn't do that, as it can affect how our program runs in competition. It may also make it harder for Autonomous to see useful information.

Implementations

However, Python doesn't really have an incredible de-facto logging library. logging is pretty close, but it lacks simple features like colored output.

Here's a list of common libs with some info about them.

Logging

Pros:

  • Comes with Python
  • Used extensively amongst the Python3 ecosystem
  • Most libraries write to it

Cons:

  • No color support!
  • Sloooooow
  • Doesn't show common information in multithreaded operations (like which thread it's running on)

loguru: logging, with better defaults

Pros:

  • Looks nice by default.
  • Shows useful debugging information in messages.
  • More akin to other languages' logging libs. Rust's tracing crate is a lot like loguru.
  • Works with other libraries that use built-in logging lib.
  • Happy with async, threads, etc.

Cons:

  • Made in Python - it's slow.

picologging

It's a drop-in replacement for logging. The only difference is that it's significantly faster! See the logging section for more info.

@onkoe onkoe changed the title ARTracker.py: Replace print with logging Replace print with logging Sep 20, 2023
@onkoe
Copy link
Member Author

onkoe commented Apr 17, 2024

actually progressed on this in #7 🥹

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

No branches or pull requests

1 participant