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

Make glog usable in Python #237

Merged
merged 6 commits into from
Jan 15, 2024
Merged

Make glog usable in Python #237

merged 6 commits into from
Jan 15, 2024

Conversation

sarlinpe
Copy link
Collaborator

  • Log the Python call stack frame when called from Python: file name, function name, line number
  • Log both C++ and Python messages to the same file:
from pycolmap import logging
logging.set_log_destination(logging.INFO, path / "INFO.log.")

def run():
    logging.info("Logging some information.")
    pycolmap.some_cpp_function()
    logging.info("Done!")

Output in path/INFO.log.20240114-232404.3281132:

I0114 23:24:04.867597 3281132 example.py:run:26] Logging some information.
I0114 23:24:08.361011 3281291 some_cpp_file.cc:198] ...
I0114 23:24:22.513118 3281132 example.py:run:28] Done!

@sarlinpe sarlinpe merged commit d51b455 into master Jan 15, 2024
6 checks passed
@sarlinpe sarlinpe deleted the sarlinpe/glog-py branch January 15, 2024 22:00
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.

2 participants