Commit Graph

9 Commits (5355a6ed8e710f34190784b27a3bf94cf208ed34)

Author SHA1 Message Date
nirenjan 204aadead0 Use __builtin_strrchr to get file base name
Prior to this change, pinelog used __FILE__ in the backtrace call.
However, this has a limitation that if used in a build system with
sources in subdirectories and/or a separate build directory, the
relative path to the file is used, giving us a backtrace like this.

    ../../daemon/x52d_main.c:51

This change checks if the compiler supports the __builtin_strrchr to
compute the file basename at compile time. If the compiler does not
support it, it falls back to using __FILE__ directly. This should not be
an issue on a modern compiler like gcc or clang.
2021-08-25 12:11:53 -07:00
nirenjan aa0a5545d0 Remove the use of config.h
Prior to this change, pinelog relied on an autoconf generated config.h
which checked if the compiler supports __attribute__ with constructor,
destructor and format. However, most modern compilers already have
support for this, and we can use the __has_attribute special operator
instead to check for this at compile time.

By eliminating the need to create a config.h file, it simplifies
integration into other projects that may not have one.
2021-08-25 12:07:40 -07:00
nirenjan bdee493f03 Add preprocessor definition to disable traces 2021-07-27 17:01:41 -07:00
nirenjan a3eb2c03d7 Add method to close output stream and reset to default 2021-07-16 08:29:11 -07:00
nirenjan 10941defb2 Add test framework 2021-07-14 11:00:44 -07:00
nirenjan 490a2e3faa Add check for __attribute__((format)) 2021-07-13 11:45:33 -07:00
nirenjan 091dd29d3b Rename functions and macros to use the pinelog_ prefix 2021-07-13 11:40:33 -07:00
nirenjan aa330a2cbf Add autotools build framework 2021-07-13 11:33:10 -07:00
nirenjan 45762f497c Initial commit 2021-07-13 10:57:22 -07:00