Log.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*******************************************************************************
  2. * Copyright (c) 2009, 2013 IBM Corp.
  3. *
  4. * All rights reserved. This program and the accompanying materials
  5. * are made available under the terms of the Eclipse Public License v1.0
  6. * and Eclipse Distribution License v1.0 which accompany this distribution.
  7. *
  8. * The Eclipse Public License is available at
  9. * http://www.eclipse.org/legal/epl-v10.html
  10. * and the Eclipse Distribution License is available at
  11. * http://www.eclipse.org/org/documents/edl-v10.php.
  12. *
  13. * Contributors:
  14. * Ian Craggs - initial API and implementation and/or initial documentation
  15. * Ian Craggs - updates for the async client
  16. *******************************************************************************/
  17. #if !defined(LOG_H)
  18. #define LOG_H
  19. /*BE
  20. map LOG_LEVELS
  21. {
  22. "TRACE_MAXIMUM" 1
  23. "TRACE_MEDIUM" 2
  24. "TRACE_MINIMUM" 3
  25. "TRACE_PROTOCOL" 4
  26. "ERROR" 5
  27. "SEVERE" 6
  28. "FATAL" 7
  29. }
  30. BE*/
  31. enum LOG_LEVELS {
  32. INVALID_LEVEL = -1,
  33. TRACE_MAXIMUM = 1,
  34. TRACE_MEDIUM,
  35. TRACE_MINIMUM,
  36. TRACE_PROTOCOL,
  37. LOG_ERROR,
  38. LOG_SEVERE,
  39. LOG_FATAL,
  40. };
  41. /*BE
  42. def trace_settings_type
  43. {
  44. n32 map LOG_LEVELS "trace_level"
  45. n32 dec "max_trace_entries"
  46. n32 dec "trace_output_level"
  47. }
  48. BE*/
  49. typedef struct
  50. {
  51. enum LOG_LEVELS trace_level; /**< trace level */
  52. int max_trace_entries; /**< max no of entries in the trace buffer */
  53. enum LOG_LEVELS trace_output_level; /**< trace level to output to destination */
  54. } trace_settings_type;
  55. extern trace_settings_type trace_settings;
  56. #define LOG_PROTOCOL TRACE_PROTOCOL
  57. #define TRACE_MAX TRACE_MAXIMUM
  58. #define TRACE_MIN TRACE_MINIMUM
  59. #define TRACE_MED TRACE_MEDIUM
  60. typedef struct
  61. {
  62. const char* name;
  63. const char* value;
  64. } Log_nameValue;
  65. int Log_initialize(Log_nameValue*);
  66. void Log_terminate(void);
  67. void Log(enum LOG_LEVELS, int, const char *, ...);
  68. void Log_stackTrace(enum LOG_LEVELS, int, int, int, const char*, int, int*);
  69. typedef void Log_traceCallback(enum LOG_LEVELS level, const char *message);
  70. void Log_setTraceCallback(Log_traceCallback* callback);
  71. void Log_setTraceLevel(enum LOG_LEVELS level);
  72. #endif