Skip to content

Certain custom formatting from spdlog doesn't work #37

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

Open
nicholas-presien opened this issue Oct 5, 2023 · 2 comments
Open

Certain custom formatting from spdlog doesn't work #37

nicholas-presien opened this issue Oct 5, 2023 · 2 comments

Comments

@nicholas-presien
Copy link

Hi all, I'm currently evaluating spdlog-python as a replacement for logging in the python standard library.

Looking at the documentation from spdlog for custom formatting, it seems like there are some patterns that are not working/ supported.

These are:

  • %@ (Source file and line)
  • %s (Basename of the source file)
  • $g (Full or relative path of the source file)
  • %# (Source line)
  • $! (Source function)

I would presume some of it wouldn't work since it's a pybind11 wrapper of the cpp code. I wonder if there are other alternative to getting some of these working, especially the source function pattern?

@justagist
Copy link
Contributor

justagist commented May 3, 2024

@nicholas-presien did you find a way to make this work for you? I have the same issue. The solution mentioned here https://github.com/gabime/spdlog/wiki/3.-Custom-formatting#source-location-flags does not work for me with spdlog-python.

@nicholas-presien
Copy link
Author

Hey @justagist, I wasn't able to get it working, I think the information or context is lost when wrap in a python wrapper.

What I did was forcing the same logging format between spdlog and python logging for the entire application.

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

2 participants