EtcPal  0.4.1
ETC Platform Abstraction Layer (EtcPal)
View other versions:
log.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2022 ETC Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *******************************************************************************
16  * This file is a part of EtcPal. For more information, go to:
17  * https://github.com/ETCLabs/EtcPal
18  ******************************************************************************/
19 
22 
23 #ifndef ETCPAL_CPP_LOG_H_
24 #define ETCPAL_CPP_LOG_H_
25 
26 #include <array>
27 #include <cstdarg>
28 #include <cstdio>
29 #include <cstring>
30 #include <memory>
31 #include <queue>
32 #include <string>
33 #include "etcpal/common.h"
34 #include "etcpal/log.h"
35 #include "etcpal/cpp/common.h"
36 #include "etcpal/cpp/mutex.h"
37 #include "etcpal/cpp/signal.h"
38 #include "etcpal/cpp/thread.h"
39 
40 namespace etcpal
41 {
118 
123 {
124 public:
126  LogTimestamp() = default;
127  constexpr LogTimestamp(unsigned int year,
128  unsigned int month,
129  unsigned int day,
130  unsigned int hour,
131  unsigned int minute,
132  unsigned int second,
133  unsigned int msec = 0,
134  int utc_offset = 0);
135 
136  bool IsValid() const noexcept;
137 
138  constexpr const EtcPalLogTimestamp& get() const noexcept;
140 
141  static LogTimestamp Invalid();
142 
143 private:
144  EtcPalLogTimestamp timestamp_{};
145 };
146 
156 constexpr LogTimestamp::LogTimestamp(unsigned int year,
157  unsigned int month,
158  unsigned int day,
159  unsigned int hour,
160  unsigned int minute,
161  unsigned int second,
162  unsigned int msec,
163  int utc_offset)
164  : timestamp_{year, month, day, hour, minute, second, msec, utc_offset}
165 {
166 }
167 
169 inline bool LogTimestamp::IsValid() const noexcept
170 {
171  return etcpal_validate_log_timestamp(&timestamp_);
172 }
173 
175 constexpr const EtcPalLogTimestamp& LogTimestamp::get() const noexcept
176 {
177  return timestamp_;
178 }
179 
182 {
183  return timestamp_;
184 }
185 
188 {
189  return LogTimestamp{};
190 }
191 
199 {
200 public:
201  virtual LogTimestamp GetLogTimestamp();
202 
213  virtual void HandleLogMessage(const EtcPalLogStrings& strings) = 0;
214 };
215 
219 {
220  return LogTimestamp::Invalid();
221 }
222 
226 {
227  kDirect,
228  kQueued
229 };
230 
236 class Logger
237 {
238 public:
239  Logger();
240 
241  bool Startup(LogMessageHandler& message_handler);
242  void Shutdown();
243 
244  bool CanLog(int pri) const noexcept;
245  void Log(int pri, const char* format, ...);
246 
249  void Debug(const char* format, ...);
250  void Info(const char* format, ...);
251  void Notice(const char* format, ...);
252  void Warning(const char* format, ...);
253  void Error(const char* format, ...);
254  void Critical(const char* format, ...);
255  void Alert(const char* format, ...);
256  void Emergency(const char* format, ...);
258 
261  LogDispatchPolicy dispatch_policy() const noexcept;
262  int log_mask() const noexcept;
263  int log_action() const noexcept;
264  int syslog_facility() const noexcept;
265  const char* syslog_hostname() const noexcept;
266  const char* syslog_app_name() const noexcept;
267  const char* syslog_procid() const noexcept;
268  const EtcPalLogParams& log_params() const noexcept;
270 
273  Logger& SetDispatchPolicy(LogDispatchPolicy new_policy) noexcept;
274  Logger& SetLogMask(int log_mask) noexcept;
275  Logger& SetLogAction(int log_action) noexcept;
276  Logger& SetSyslogFacility(int facility) noexcept;
277  Logger& SetSyslogHostname(const char* hostname) noexcept;
278  Logger& SetSyslogHostname(const std::string& hostname) noexcept;
279  Logger& SetSyslogAppName(const char* app_name) noexcept;
280  Logger& SetSyslogAppName(const std::string& app_name) noexcept;
281  Logger& SetSyslogProcId(const char* proc_id) noexcept;
282  Logger& SetSyslogProcId(const std::string& proc_id) noexcept;
283  Logger& SetSyslogProcId(int proc_id) noexcept;
284 
285  Logger& SetThreadPriority(unsigned int priority) noexcept;
286  Logger& SetThreadStackSize(unsigned int stack_size) noexcept;
287  Logger& SetThreadName(const char* name) noexcept;
288  Logger& SetThreadName(const std::string& name) noexcept;
289  Logger& SetThreadPlatformData(void* platform_data) noexcept;
291 
292 private:
293  void LogInternal(int pri, const char* format, std::va_list args);
294  void LogThreadRun();
295  void EmptyLogQueue();
296 
298  EtcPalLogParams log_params_{};
299 
300  struct LogMessage
301  {
302  int pri;
303  std::array<char, ETCPAL_RAW_LOG_MSG_MAX_LEN> buf;
304  };
305 
306  // Used when dispatch_policy_ == Queued
307  // This implementation will become more elegant with the addition of new queue APIs. This is
308  // being tracked with ETCPAL-43 and ETCPAL-46.
309  std::queue<LogMessage> msg_q_;
310  std::unique_ptr<etcpal::Signal> signal_;
311  std::unique_ptr<etcpal::Mutex> mutex_;
312  etcpal::Thread thread_;
313  bool running_{false};
314 };
315 
317 
318 extern "C" inline void LogCallbackFn(void* context, const EtcPalLogStrings* strings)
319 {
320  if (context && strings)
321  {
322  static_cast<LogMessageHandler*>(context)->HandleLogMessage(*strings);
323  }
324 }
325 
326 extern "C" inline void LogTimestampFn(void* context, EtcPalLogTimestamp* timestamp)
327 {
328  if (context && timestamp)
329  {
330  *timestamp = static_cast<LogMessageHandler*>(context)->GetLogTimestamp().get();
331  }
332 }
333 
335 
336 inline Logger::Logger()
337 {
338  // Default logging parameters
340  log_params_.log_fn = LogCallbackFn;
342  log_params_.time_fn = LogTimestampFn;
343  log_params_.context = nullptr;
344 }
345 
352 inline bool Logger::Startup(LogMessageHandler& message_handler)
353 {
355  return false;
356 
357  if (!etcpal_validate_log_params(&log_params_))
358  {
360  return false;
361  }
362 
363  log_params_.context = &message_handler;
364 
365  if (dispatch_policy_ == LogDispatchPolicy::kDirect)
366  {
367  running_ = true;
368  return true;
369  }
370 
371  // kQueued
372  // Start the log dispatch thread
373  running_ = true;
374  signal_ = std::unique_ptr<etcpal::Signal>(new etcpal::Signal);
375  mutex_ = std::unique_ptr<etcpal::Mutex>(new etcpal::Mutex);
376  if (!thread_.SetName("EtcPalLoggerThread").Start(&Logger::LogThreadRun, this))
377  {
379  return false;
380  }
381  return true;
382 }
383 
388 inline void Logger::Shutdown()
389 {
390  if (running_)
391  {
392  running_ = false;
393  if (dispatch_policy_ == LogDispatchPolicy::kQueued)
394  {
395  signal_->Notify();
396  thread_.Join();
397  }
399  log_params_.context = nullptr;
400  }
401 }
402 
406 inline bool Logger::CanLog(int pri) const noexcept
407 {
408  return etcpal_can_log(&log_params_, pri);
409 }
410 
418 inline void Logger::Log(int pri, const char* format, ...)
419 {
420  std::va_list args;
421  va_start(args, format);
422  LogInternal(pri, format, args);
423  va_end(args);
424 }
425 
427 inline void Logger::Debug(const char* format, ...)
428 {
429  std::va_list args;
430  va_start(args, format);
431  LogInternal(ETCPAL_LOG_DEBUG, format, args);
432  va_end(args);
433 }
434 
436 inline void Logger::Info(const char* format, ...)
437 {
438  std::va_list args;
439  va_start(args, format);
440  LogInternal(ETCPAL_LOG_INFO, format, args);
441  va_end(args);
442 }
443 
445 inline void Logger::Notice(const char* format, ...)
446 {
447  std::va_list args;
448  va_start(args, format);
449  LogInternal(ETCPAL_LOG_NOTICE, format, args);
450  va_end(args);
451 }
452 
454 inline void Logger::Warning(const char* format, ...)
455 {
456  std::va_list args;
457  va_start(args, format);
458  LogInternal(ETCPAL_LOG_WARNING, format, args);
459  va_end(args);
460 }
461 
463 inline void Logger::Error(const char* format, ...)
464 {
465  std::va_list args;
466  va_start(args, format);
467  LogInternal(ETCPAL_LOG_ERR, format, args);
468  va_end(args);
469 }
470 
472 inline void Logger::Critical(const char* format, ...)
473 {
474  std::va_list args;
475  va_start(args, format);
476  LogInternal(ETCPAL_LOG_CRIT, format, args);
477  va_end(args);
478 }
479 
481 inline void Logger::Alert(const char* format, ...)
482 {
483  std::va_list args;
484  va_start(args, format);
485  LogInternal(ETCPAL_LOG_ALERT, format, args);
486  va_end(args);
487 }
488 
490 inline void Logger::Emergency(const char* format, ...)
491 {
492  std::va_list args;
493  va_start(args, format);
494  LogInternal(ETCPAL_LOG_EMERG, format, args);
495  va_end(args);
496 }
497 
500 {
501  return dispatch_policy_;
502 }
503 
505 inline int Logger::log_mask() const noexcept
506 {
507  return log_params_.log_mask;
508 }
509 
511 inline int Logger::log_action() const noexcept
512 {
513  return log_params_.action;
514 }
515 
517 inline int Logger::syslog_facility() const noexcept
518 {
519  return log_params_.syslog_params.facility;
520 }
521 
523 inline const char* Logger::syslog_hostname() const noexcept
524 {
525  return log_params_.syslog_params.hostname;
526 }
527 
529 inline const char* Logger::syslog_app_name() const noexcept
530 {
531  return log_params_.syslog_params.app_name;
532 }
533 
535 inline const char* Logger::syslog_procid() const noexcept
536 {
537  return log_params_.syslog_params.procid;
538 }
539 
545 inline const EtcPalLogParams& Logger::log_params() const noexcept
546 {
547  return log_params_;
548 }
549 
556 {
557  dispatch_policy_ = new_policy;
558  return *this;
559 }
560 
568 inline Logger& Logger::SetLogMask(int log_mask) noexcept
569 {
570  log_params_.log_mask = log_mask;
571  return *this;
572 }
573 
575 inline Logger& Logger::SetLogAction(int log_action) noexcept
576 {
577  log_params_.action = log_action;
578  return *this;
579 }
580 
582 inline Logger& Logger::SetSyslogFacility(int facility) noexcept
583 {
584  log_params_.syslog_params.facility = facility;
585  return *this;
586 }
587 
589 inline Logger& Logger::SetSyslogHostname(const char* hostname) noexcept
590 {
591  ETCPAL_MSVC_NO_DEP_WRN strncpy(log_params_.syslog_params.hostname, hostname, ETCPAL_LOG_HOSTNAME_MAX_LEN - 1);
592  log_params_.syslog_params.hostname[ETCPAL_LOG_HOSTNAME_MAX_LEN - 1] = '\0';
593  return *this;
594 }
595 
597 inline Logger& Logger::SetSyslogHostname(const std::string& hostname) noexcept
598 {
599  SetSyslogHostname(hostname.c_str());
600  return *this;
601 }
602 
604 inline Logger& Logger::SetSyslogAppName(const char* app_name) noexcept
605 {
606  ETCPAL_MSVC_NO_DEP_WRN strncpy(log_params_.syslog_params.app_name, app_name, ETCPAL_LOG_APP_NAME_MAX_LEN - 1);
607  log_params_.syslog_params.app_name[ETCPAL_LOG_APP_NAME_MAX_LEN - 1] = '\0';
608  return *this;
609 }
610 
612 inline Logger& Logger::SetSyslogAppName(const std::string& app_name) noexcept
613 {
614  SetSyslogAppName(app_name.c_str());
615  return *this;
616 }
617 
619 inline Logger& Logger::SetSyslogProcId(const char* proc_id) noexcept
620 {
621  ETCPAL_MSVC_NO_DEP_WRN strncpy(log_params_.syslog_params.procid, proc_id, ETCPAL_LOG_PROCID_MAX_LEN - 1);
622  log_params_.syslog_params.procid[ETCPAL_LOG_PROCID_MAX_LEN - 1] = '\0';
623  return *this;
624 }
625 
627 inline Logger& Logger::SetSyslogProcId(const std::string& proc_id) noexcept
628 {
629  SetSyslogProcId(proc_id.c_str());
630  return *this;
631 }
632 
636 inline Logger& Logger::SetThreadPriority(unsigned int priority) noexcept
637 {
638  thread_.SetPriority(priority);
639  return *this;
640 }
641 
645 inline Logger& Logger::SetThreadStackSize(unsigned int stack_size) noexcept
646 {
647  thread_.SetStackSize(stack_size);
648  return *this;
649 }
650 
654 inline Logger& Logger::SetThreadName(const char* name) noexcept
655 {
656  thread_.SetName(name);
657  return *this;
658 }
659 
663 inline Logger& Logger::SetThreadName(const std::string& name) noexcept
664 {
665  thread_.SetName(name);
666  return *this;
667 }
668 
672 inline Logger& Logger::SetThreadPlatformData(void* platform_data) noexcept
673 {
674  thread_.SetPlatformData(platform_data);
675  return *this;
676 }
677 
679 inline Logger& Logger::SetSyslogProcId(int proc_id) noexcept
680 {
681  ETCPAL_MSVC_NO_DEP_WRN sprintf(log_params_.syslog_params.procid, "%d", proc_id);
682  return *this;
683 }
684 
685 // Private functions
686 
687 inline void Logger::LogInternal(int pri, const char* format, std::va_list args)
688 {
689  if (running_)
690  {
691  if (dispatch_policy_ == LogDispatchPolicy::kDirect)
692  {
693  etcpal_vlog(&log_params_, pri, format, args);
694  }
695  else
696  {
697  {
698  etcpal::MutexGuard lock(*mutex_);
699  msg_q_.emplace();
700  msg_q_.back().pri = pri;
701  vsnprintf(msg_q_.back().buf.data(), ETCPAL_RAW_LOG_MSG_MAX_LEN, format, args);
702  }
703  signal_->Notify();
704  }
705  }
706 }
707 
708 inline void Logger::LogThreadRun()
709 {
710  while (running_)
711  {
712  EmptyLogQueue();
713  signal_->Wait();
714  }
715  // Bail the queue one last time on exit
716  EmptyLogQueue();
717 }
718 
719 inline void Logger::EmptyLogQueue()
720 {
721  std::queue<LogMessage> to_log;
722  {
723  etcpal::MutexGuard lock(*mutex_);
724  to_log.swap(msg_q_);
725  }
726 
727  while (!to_log.empty())
728  {
729  etcpal_log(&log_params_, to_log.front().pri, "%s", to_log.front().buf.data());
730  to_log.pop();
731  }
732 }
733 
734 }; // namespace etcpal
735 
736 #endif // ETCPAL_CPP_LOG_H_
An interface which handles log messages.
Definition: log.h:199
virtual void HandleLogMessage(const EtcPalLogStrings &strings)=0
Define this function to handle log messages and determine what to do with them.
virtual LogTimestamp GetLogTimestamp()
Return a LogTimestamp representing the current local time.
Definition: log.h:218
An object representing the current local time with millisecond resolution for logging purposes.
Definition: log.h:123
constexpr const EtcPalLogTimestamp & get() const noexcept
Get a const reference to the underlying C type.
Definition: log.h:175
bool IsValid() const noexcept
Whether this timestamp represents a valid time.
Definition: log.h:169
LogTimestamp()=default
Construct an invalid timestamp by default.
static LogTimestamp Invalid()
Construct an invalid timestamp.
Definition: log.h:187
A class for dispatching log messages.
Definition: log.h:237
Logger & SetSyslogFacility(int facility) noexcept
Set the Syslog facility value; see RFC 5424 § 6.2.1.
Definition: log.h:582
void Critical(const char *format,...)
Log a message at critical priority.
Definition: log.h:472
void Info(const char *format,...)
Log a message at informational priority.
Definition: log.h:436
Logger & SetThreadPlatformData(void *platform_data) noexcept
Set the platform-specific parameter data of the log dispatch thread.
Definition: log.h:672
bool CanLog(int pri) const noexcept
Determine whether a priority level can be logged using the mask given via SetLogMask().
Definition: log.h:406
LogDispatchPolicy dispatch_policy() const noexcept
Get the current log dispatch policy.
Definition: log.h:499
Logger & SetLogAction(int log_action) noexcept
Set the types of log messages to create and dispatch to the LogMessageHandler.
Definition: log.h:575
void Error(const char *format,...)
Log a message at error priority.
Definition: log.h:463
int log_action() const noexcept
Get the current log action.
Definition: log.h:511
void Emergency(const char *format,...)
Log a message at emergency priority.
Definition: log.h:490
Logger & SetThreadStackSize(unsigned int stack_size) noexcept
Set the stack size of the log dispatch thread.
Definition: log.h:645
void Alert(const char *format,...)
Log a message at alert priority.
Definition: log.h:481
bool Startup(LogMessageHandler &message_handler)
Start logging.
Definition: log.h:352
int syslog_facility() const noexcept
Get the current Syslog facility value.
Definition: log.h:517
Logger & SetSyslogHostname(const char *hostname) noexcept
Set the Syslog HOSTNAME; see RFC 5424 § 6.2.4.
Definition: log.h:589
void Warning(const char *format,...)
Log a message at warning priority.
Definition: log.h:454
Logger & SetSyslogAppName(const char *app_name) noexcept
Set the Syslog APP-NAME; see RFC 5424 § 6.2.5.
Definition: log.h:604
const EtcPalLogParams & log_params() const noexcept
Get the log params used by this logger.
Definition: log.h:545
const char * syslog_hostname() const noexcept
Get the current Syslog HOSTNAME.
Definition: log.h:523
void Log(int pri, const char *format,...)
Log a message.
Definition: log.h:418
const char * syslog_procid() const noexcept
Get the current Syslog PROCID.
Definition: log.h:535
void Shutdown()
Stop logging.
Definition: log.h:388
const char * syslog_app_name() const noexcept
Get the current Syslog APP-NAME.
Definition: log.h:529
int log_mask() const noexcept
Get the current log mask.
Definition: log.h:505
Logger & SetThreadName(const char *name) noexcept
Set the name of the log dispatch thread.
Definition: log.h:654
Logger & SetLogMask(int log_mask) noexcept
Set a new log mask.
Definition: log.h:568
Logger & SetSyslogProcId(const char *proc_id) noexcept
Set the Syslog PROCID; see RFC 5424 § 6.2.6.
Definition: log.h:619
void Debug(const char *format,...)
Log a message at debug priority.
Definition: log.h:427
Logger & SetThreadPriority(unsigned int priority) noexcept
Set the priority of the log dispatch thread.
Definition: log.h:636
Logger & SetDispatchPolicy(LogDispatchPolicy new_policy) noexcept
Change the dispatch policy of this logger.
Definition: log.h:555
void Notice(const char *format,...)
Log a message at notice priority.
Definition: log.h:445
Lock guard around a mutex.
Definition: mutex.h:173
A wrapper class for the EtcPal mutex type.
Definition: mutex.h:88
A wrapper class for the EtcPal signal type.
Definition: signal.h:89
A thread class, modeled after std::thread.
Definition: thread.h:143
Error Start(Function &&func, Args &&... args)
Associate this thread object with a new thread of execution.
Definition: thread.h:425
Thread & SetName(const char *name) noexcept
Set the name of this thread.
Definition: thread.h:355
Error Join(int timeout_ms=ETCPAL_WAIT_FOREVER) noexcept
Wait for the thread to finish execution.
Definition: thread.h:459
Common definitions used by EtcPal C++ wrappers.
C++ wrapper and utilities for etcpal/mutex.h.
C++ wrapper and utilities for etcpal/signal.h.
C++ wrapper and utilities for etcpal/thread.h.
LogDispatchPolicy
Options for the method by which the Logger dispatches log messages.
Definition: log.h:226
@ kQueued
Log messages are queued and dispatched from another thread (recommended)
@ kDirect
Log messages propagate directly from Log() calls to output streams (normally only used for testing)
#define ETCPAL_CONSTEXPR_14
Stand-in for "constexpr" on entities that can only be defined "constexpr" in C++14 or later.
Definition: common.h:53
#define ETCPAL_CONSTEXPR_14_OR_INLINE
Defined to "constexpr" in C++14 or later, "inline" earlier.
Definition: common.h:54
@ kEtcPalErrOk
The call was successful, no error occurred.
Definition: error.h:51
#define ETCPAL_LOG_ERR
Error conditions.
Definition: log.h:178
#define ETCPAL_LOG_PROCID_MAX_LEN
Max length of the procid param.
Definition: log.h:198
#define ETCPAL_LOG_CRIT
Critical conditions.
Definition: log.h:177
#define ETCPAL_RAW_LOG_MSG_MAX_LEN
Max length of a log message string passed to etcpal_log() or etcpal_vlog().
Definition: log.h:201
#define ETCPAL_LOG_APP_NAME_MAX_LEN
Max length of the app_name param.
Definition: log.h:197
#define ETCPAL_LOG_NOTICE
Normal but significant condition.
Definition: log.h:180
void etcpal_vlog(const EtcPalLogParams *params, int pri, const char *format, va_list args)
Log a message with the list of format arguments already generated.
Definition: log.c:424
#define ETCPAL_LOG_CREATE_HUMAN_READABLE
Create a log string with a human-readable prefix including timestamp and severity.
Definition: log.h:340
#define ETCPAL_LOG_DEBUG
Debug-level messages.
Definition: log.h:182
bool etcpal_validate_log_timestamp(const EtcPalLogTimestamp *timestamp)
Determine whether the given EtcPalLogTimestamp is valid.
Definition: log.c:369
bool etcpal_validate_log_params(EtcPalLogParams *params)
Ensure that the given EtcPalLogParams are valid.
Definition: log.c:347
#define ETCPAL_LOG_INFO
Informational.
Definition: log.h:181
#define ETCPAL_LOG_EMERG
System is unusable.
Definition: log.h:175
void etcpal_log(const EtcPalLogParams *params, int pri, const char *format,...)
Log a message.
Definition: log.c:405
bool etcpal_can_log(const EtcPalLogParams *params, int pri)
Determine whether a priority level can be logged given the mask present in the log params.
Definition: log.c:388
#define ETCPAL_LOG_WARNING
Warning conditions.
Definition: log.h:179
#define ETCPAL_LOG_UPTO(pri)
Create a priority mask for all priorities through pri.
Definition: log.h:194
#define ETCPAL_LOG_ALERT
Action must be taken immediately.
Definition: log.h:176
#define ETCPAL_LOG_HOSTNAME_MAX_LEN
Max length of the hostname param.
Definition: log.h:196
void etcpal_deinit(etcpal_features_t features)
Deinitialize the EtcPal library.
Definition: common.c:136
etcpal_error_t etcpal_init(etcpal_features_t features)
Initialize the EtcPal library.
Definition: common.c:87
#define ETCPAL_FEATURE_LOGGING
Use the etcpal/log module.
Definition: common.h:130
A set of parameters used for the etcpal_*log() functions.
Definition: log.h:375
EtcPalSyslogParams syslog_params
The syslog header parameters.
Definition: log.h:381
EtcPalLogCallback log_fn
A callback function for the finished log string(s).
Definition: log.h:379
int action
What should be done when etcpal_log() or etcpal_vlog() is called.
Definition: log.h:377
int log_mask
A mask value that determines which priority messages can be logged.
Definition: log.h:383
EtcPalLogTimeFn time_fn
A callback function for the etcpal_log() and etcpal_vlog() functions to obtain the time from the appl...
Definition: log.h:388
void * context
Application context that will be passed back with the log callback function.
Definition: log.h:390
The set of log strings passed with a call to an etcpal_log_callback function.
Definition: log.h:288
A set of parameters which represent the current local time with millisecond resolution.
Definition: log.h:272
int facility
Syslog Facility; see RFC 5424 § 6.2.1.
Definition: log.h:350
char app_name[ETCPAL_LOG_APP_NAME_MAX_LEN]
Syslog APP-NAME; see RFC 5424 § 6.2.5.
Definition: log.h:354
char procid[ETCPAL_LOG_PROCID_MAX_LEN]
Syslog PROCID; see RFC 5424 § 6.2.6.
Definition: log.h:356
char hostname[ETCPAL_LOG_HOSTNAME_MAX_LEN]
Syslog HOSTNAME; see RFC 5424 § 6.2.4.
Definition: log.h:352