log.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. #ifndef LIBHDFSPP_HDFS_LOG
  19. #define LIBHDFSPP_HDFS_LOG
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. /**
  24. * Things that are part of the public API but are specific to logging live here.
  25. * Added to avoid including the whole public API into the implementation of the logger.
  26. **/
  27. /* logging levels, compatible with enum in lib/common/logging.cc */
  28. #define HDFSPP_LOG_LEVEL_TRACE 0
  29. #define HDFSPP_LOG_LEVEL_DEBUG 1
  30. #define HDFSPP_LOG_LEVEL_INFO 2
  31. #define HDFSPP_LOG_LEVEL_WARN 3
  32. #define HDFSPP_LOG_LEVEL_ERROR 4
  33. /* components emitting messages, compatible with enum lib/common/logging.cc */
  34. #define HDFSPP_LOG_COMPONENT_UNKNOWN 1 << 0
  35. #define HDFSPP_LOG_COMPONENT_RPC 1 << 1
  36. #define HDFSPP_LOG_COMPONENT_BLOCKREADER 1 << 2
  37. #define HDFSPP_LOG_COMPONENT_FILEHANDLE 1 << 3
  38. #define HDFSPP_LOG_COMPONENT_FILESYSTEM 1 << 4
  39. /**
  40. * POD struct for C to consume (C++ interface gets to take advantage of RAII)
  41. **/
  42. typedef struct {
  43. const char *msg;
  44. int level;
  45. int component;
  46. const char *file_name;
  47. int file_line;
  48. } LogData;
  49. #ifdef __cplusplus
  50. } // end extern C
  51. #endif
  52. #endif