logging_event.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /* $Id$
  2. *
  3. * logging_event.h
  4. *
  5. * Copyright 2001-2003, Meiosys (www.meiosys.com). All rights reserved.
  6. *
  7. * See the COPYING file for the terms of usage and distribution.
  8. */
  9. #ifndef log4c_logging_event_h
  10. #define log4c_logging_event_h
  11. /**
  12. * @file logging_event.h
  13. *
  14. * @brief the internal representation of logging events.
  15. *
  16. * When a affirmative logging decision is made a log4c_logging_event
  17. * instance is created. This instance is passed around the different log4c
  18. * components.
  19. **/
  20. #include <log4c/defs.h>
  21. #include <log4c/buffer.h>
  22. #include <log4c/location_info.h>
  23. #ifndef _WIN32
  24. #include <sys/time.h>
  25. #endif
  26. __LOG4C_BEGIN_DECLS
  27. struct __log4c_category;
  28. /**
  29. * @brief logging event object
  30. *
  31. * Attributes description:
  32. *
  33. * @li @c evt_category category name.
  34. * @li @c evt_priority priority of logging event.
  35. * @li @c evt_msg The application supplied message of logging event.
  36. * @li @c evt_buffer a pre allocated buffer to be used by layouts to
  37. * format in a multi-thread environment.
  38. * @li @c evt_rendered_msg The application supplied message after layout format.
  39. * @li @c evt_timestamp The number of seconds elapsed since the epoch
  40. * (1/1/1970 00:00:00 UTC) until logging event was created.
  41. * @li @c evt_loc The event's location information
  42. **/
  43. typedef struct
  44. {
  45. const char* evt_category;
  46. int evt_priority;
  47. const char* evt_msg;
  48. const char* evt_rendered_msg;
  49. log4c_buffer_t evt_buffer;
  50. /* ok, this is probably not a good way to do it--should define a common type here
  51. and have the base acessor function do the mapping
  52. */
  53. #ifndef _WIN32
  54. struct timeval evt_timestamp;
  55. #else
  56. FILETIME evt_timestamp;
  57. #endif
  58. const log4c_location_info_t* evt_loc;
  59. } log4c_logging_event_t;
  60. /**
  61. * Constructor for a logging event.
  62. *
  63. * @param a_category the category name
  64. * @param a_priority the category initial priority
  65. * @param a_message the message of this event
  66. *
  67. * @todo need to handle multi-threading (NDC)
  68. **/
  69. LOG4C_API log4c_logging_event_t* log4c_logging_event_new(
  70. const char* a_category,
  71. int a_priority,
  72. const char* a_message);
  73. /**
  74. * Destructor for a logging event.
  75. * @param a_event the logging event object
  76. **/
  77. LOG4C_API void log4c_logging_event_delete(log4c_logging_event_t* a_event);
  78. __LOG4C_END_DECLS
  79. #endif