This file is indexed.

/usr/include/purify/logging.enabled.h is in libpurify-dev 2.0.0-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#ifndef PURIFY_LOGGING_ENABLED_H
#define PURIFY_LOGGING_ENABLED_H

#include "purify/config.h"
#include <spdlog/fmt/ostr.h>
#include <spdlog/spdlog.h>

namespace purify {
namespace logging {
void set_level(std::string const &level, std::string const &name = "");

//! \brief Initializes a logger.
//! \details Logger only exists as long as return is kept alive.
inline std::shared_ptr<spdlog::logger> initialize(std::string const &name = "") {
  auto const result = spdlog::stdout_logger_mt(default_logger_name() + name);
  set_level(default_logging_level(), name);
  return result;
}

//! Returns shared pointer to logger or null if it does not exist
inline std::shared_ptr<spdlog::logger> get(std::string const &name = "") {
  return spdlog::get(default_logger_name() + name);
}

//! \brief Sets loggin level
//! \details Levels can be one of
//!     - "trace"
//!     - "debug"
//!     - "info"
//!     - "warn"
//!     - "err"
//!     - "critical"
//!     - "off"
inline void set_level(std::string const &level, std::string const &name) {
  auto const logger = get(name);
  if(not logger)
    throw std::runtime_error("No logger by the name of " + std::string(name));
#define PURIFY_MACRO(LEVEL)                                                                        \
  if(level == #LEVEL)                                                                              \
  logger->set_level(spdlog::level::LEVEL)
  PURIFY_MACRO(trace);
  else PURIFY_MACRO(debug);
  else PURIFY_MACRO(info);
  else PURIFY_MACRO(warn);
  else PURIFY_MACRO(err);
  else PURIFY_MACRO(critical);
  else PURIFY_MACRO(off);
#undef PURIFY_MACRO
  else throw std::runtime_error("Unknown logging level " + std::string(level));
}

inline bool has_level(std::string const &level, std::string const &name = "") {
  auto const logger = get(name);
  if(not logger)
    return false;

#define PURIFY_MACRO(LEVEL)                                                                        \
  if(level == #LEVEL)                                                                              \
  return logger->level() >= spdlog::level::LEVEL
  PURIFY_MACRO(trace);
  else PURIFY_MACRO(debug);
  else PURIFY_MACRO(info);
  else PURIFY_MACRO(warn);
  else PURIFY_MACRO(err);
  else PURIFY_MACRO(critical);
  else PURIFY_MACRO(off);
#undef PURIFY_MACRO
  else throw std::runtime_error("Unknown logging level " + std::string(level));
}
}
}

//! \macro For internal use only
#define PURIFY_LOG_(NAME, TYPE, ...)                                                               \
  if(auto purify_logging_##__func__##_##__LINE__ = purify::logging::get(NAME))                     \
  purify_logging_##__func__##_##__LINE__->TYPE(__VA_ARGS__)

#endif