You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
2.5 KiB

  1. // -*- C -*-
  2. /**
  3. * Module: Log4CPLUS
  4. * File: clogger.h
  5. * Created: 01/2011
  6. * Author: Jens Rehsack
  7. *
  8. *
  9. * Copyright 2011-2013 Jens Rehsack & Tad E. Smith
  10. *
  11. * Licensed under the Apache License, Version 2.0 (the "License");
  12. * you may not use this file except in compliance with the License.
  13. * You may obtain a copy of the License at
  14. *
  15. * http://www.apache.org/licenses/LICENSE-2.0
  16. *
  17. * Unless required by applicable law or agreed to in writing, software
  18. * distributed under the License is distributed on an "AS IS" BASIS,
  19. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  20. * See the License for the specific language governing permissions and
  21. * limitations under the License.
  22. */
  23. /** @file
  24. * This header defines the C API for log4cplus and the logging macros. */
  25. #ifndef LOG4CPLUS_CLOGGERHEADER_
  26. #define LOG4CPLUS_CLOGGERHEADER_
  27. #include <log4cplus/config.hxx>
  28. #if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
  29. #pragma once
  30. #endif
  31. #ifdef __cplusplus
  32. extern "C"
  33. {
  34. #endif
  35. // TODO UNICDE capable
  36. typedef void *logger_t;
  37. typedef int loglevel_t;
  38. #define L4CP_OFF_LOG_LEVEL 60000
  39. #define L4CP_FATAL_LOG_LEVEL 50000
  40. #define L4CP_ERROR_LOG_LEVEL 40000
  41. #define L4CP_WARN_LOG_LEVEL 30000
  42. #define L4CP_INFO_LOG_LEVEL 20000
  43. #define L4CP_DEBUG_LOG_LEVEL 10000
  44. #define L4CP_TRACE_LOG_LEVEL 0
  45. #define L4CP_ALL_LOG_LEVEL TRACE_LOG_LEVEL
  46. #define L4CP_NOT_SET_LOG_LEVEL -1
  47. #ifdef UNICODE
  48. # define LOG4CPLUS_TEXT2(STRING) L##STRING
  49. typedef wchar_t log4cplus_char_t;
  50. #else
  51. # define LOG4CPLUS_TEXT2(STRING) STRING
  52. typedef char log4cplus_char_t;
  53. #endif // UNICODE
  54. #define LOG4CPLUS_TEXT(STRING) LOG4CPLUS_TEXT2(STRING)
  55. LOG4CPLUS_EXPORT int log4cplus_file_configure(const log4cplus_char_t *pathname);
  56. LOG4CPLUS_EXPORT int log4cplus_str_configure(const log4cplus_char_t *config);
  57. LOG4CPLUS_EXPORT int log4cplus_basic_configure(void);
  58. LOG4CPLUS_EXPORT void log4cplus_shutdown(void);
  59. LOG4CPLUS_EXPORT int log4cplus_logger_exists(const log4cplus_char_t *name);
  60. LOG4CPLUS_EXPORT int log4cplus_logger_is_enabled_for(
  61. const log4cplus_char_t *name, loglevel_t ll);
  62. LOG4CPLUS_EXPORT int log4cplus_logger_log(const log4cplus_char_t *name,
  63. loglevel_t ll, const log4cplus_char_t *msgfmt, ...)
  64. LOG4CPLUS_FORMAT_ATTRIBUTE (__printf__, 3, 4);
  65. LOG4CPLUS_EXPORT int log4cplus_logger_force_log(const log4cplus_char_t *name,
  66. loglevel_t ll, const log4cplus_char_t *msgfmt, ...)
  67. LOG4CPLUS_FORMAT_ATTRIBUTE (__printf__, 3, 4);
  68. #ifdef __cplusplus
  69. }
  70. #endif
  71. #endif /*?LOG4CPLUS_CLOGGERHEADER_*/