Git Product home page Git Product logo

Comments (8)

SergiusTheBest avatar SergiusTheBest commented on August 12, 2024

Hi!

Actually I tried to use it in the past and got the following results:

  • __FILE__ cases full file paths to be present in a binary (that is not desirable)
  • In most cases a function name gives more meaningful information than a file name

So I decided to drop __FILE__ in favor of __FUNC__.

If you have any thoughts about this please share.

from plog.

stephane-martin avatar stephane-martin commented on August 12, 2024

Well, my needs are rather specific... i write a Python module based on some C++ library. I use plog for the C++ part, and i need to get the logs back to the standard Python logging system (so that the end user also has to care about Python).

Somewhere in the cooking i have to build a Python LogRecord object (https://docs.python.org/2/library/logging.html#logrecord-objects). This kind of object typically references the source filename.

("FILE cases full file paths to be present in a binary (that is not desirable)" -> definitely agree, thats why #line can be useful: https://gcc.gnu.org/onlinedocs/cpp/Line-Control.html#Line-Control)

from plog.

SergiusTheBest avatar SergiusTheBest commented on August 12, 2024

#line could help but it requires you to manually specify file names.

What if you just return an empty file name?

from plog.

stephane-martin avatar stephane-martin commented on August 12, 2024

well, then i don't have the C source filename in Python logs :) Right now i push FILE into Record void* 'object' field, but that doesnt feel "clean".

from plog.

SergiusTheBest avatar SergiusTheBest commented on August 12, 2024

Hey, take a look at the capture-file branch. Will that work for you?

from plog.

stephane-martin avatar stephane-martin commented on August 12, 2024

Sure, thanks !

(I do think that to provide FILE it's not possible to only work by inheritance, as a custom LogRecord class is not really possible for the user)

from plog.

SergiusTheBest avatar SergiusTheBest commented on August 12, 2024

@stephane-martin How is it going?

from plog.

SergiusTheBest avatar SergiusTheBest commented on August 12, 2024

Merged to master.

from plog.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.