spdlog-python icon indicating copy to clipboard operation
spdlog-python copied to clipboard

Certain custom formatting from spdlog doesn't work

Open nicholas-presien opened this issue 2 years ago • 2 comments

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?

nicholas-presien avatar Oct 05 '23 01:10 nicholas-presien

@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.

justagist avatar May 03 '24 12:05 justagist

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.

nicholas-presien avatar May 06 '24 00:05 nicholas-presien