Commit Graph

10 Commits (c1d9cb08759f2ed9d398c5495241ad3c44ca63a4)

Author SHA1 Message Date
nirenjan c1d9cb0875 Do not print NULL module names
Prior to this change, if a module had not registered a name, then the
output would display `(null): `, which was not really helpful. This
change eliminates that by checking if the module name is not NULL prior
to calling the print routines.
2021-11-10 09:27:40 -08:00
nirenjan 3be94a24ba Update logging library to include module and string buffer
This commit adds the following changes to pinelog:

- Optional buffer to write the message to prior to writing to the output
  stream. This reduces the likelihood of log messages from multiple
  threads interleaving due to multiple calls to fputs/fprintf, etc. The
  default is to still write directly to the output stream, but the
  integrator can add a define of PINELOG_BUFFER_SZ to the CFLAGS, and
  this will allow the application to log messages that are shorter than
  the above size, including the timestamp, level and backtrace if any.

- Optional module level logging. This allows more fine-grained
  debugging, where the application can control the log levels of the
  individual modules. By default, when modules are configured, they
  default to the global log level, but this can be overridden by the
  application.
2021-11-08 16:18:30 -08: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 27a5eab8b7 Use localtime_r instead of localtime 2021-08-03 11:25:25 -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