This file is indexed.

/usr/include/Rivet/Tools/Logging.hh is in librivet-dev 1.8.3-1.1.

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
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#ifndef RIVET_LOGGING_HH
#define RIVET_LOGGING_HH

#include "Rivet/Rivet.hh"

namespace Rivet {


  class Log {
  public:

    /// Log priority levels.
    enum Level {
      TRACE = 0, DEBUG = 10, INFO = 20, WARN = 30, WARNING = 30, ERROR = 40, CRITICAL = 50, ALWAYS = 50
    };

    /// Typedef for a collection of named logs.
    typedef std::map<std::string, Log*> LogMap;

    /// Typedef for a collection of named log levels.
    typedef std::map<std::string, int> LevelMap;

    /// Typedef for a collection of shell color codes, accessed by log level.
    typedef std::map<int, std::string> ColorCodes;

  private:
    /// A static map of existing logs: we don't make more loggers than necessary.
    static LogMap existingLogs;

    /// A static map of default log levels.
    static LevelMap defaultLevels;

    /// A static map of shell color codes for the log levels.
    static ColorCodes colorCodes;

    /// Shell color code for the end of the log levels.
    static std::string endColorCode;

    /// Show timestamp?
    static bool showTimestamp;

    /// Show log level?
    static bool showLogLevel;

    /// Show logger name?
    static bool showLoggerName;

    /// Use shell colour escape codes?
    static bool useShellColors;

  public:
    /// Set the log levels
    static void setLevel(const std::string& name, int level);
    static void setLevels(const LevelMap& logLevels);

    static void setShowTimestamp(bool showTime=true) {
      showTimestamp = showTime;
    }

    static void setShowLevel(bool showLevel=true) {
      showLogLevel = showLevel;
    }

    static void setShowLoggerName(bool showName=true) {
      showLoggerName = showName;
    }

    static void setUseColors(bool useColors=true) {
      useShellColors = useColors;
    }

  protected:

    /// @name Hidden constructors etc.
    //@{

    /// Constructor 1
    Log(const std::string& name);

    /// Constructor 2
    Log(const std::string& name, int level);

    //@}

    static std::string getColorCode(int level);

  public:

    /// Get a logger with the given name. The level will be taken from the
    /// "requestedLevels" static map or will be INFO by default.
    static Log& getLog(const std::string& name);

  public:
    /// Get the priority level of this logger.
    int getLevel() const {
      return _level;
    }

    /// Set the priority level of this logger.
    Log& setLevel(int level) {
      _level = level;
      return *this;
    }

    /// Get a log level enum from a string.
    static Level getLevelFromName(const std::string& level);

    /// Get the std::string representation of a log level.
    static std::string getLevelName(int level);

    /// Get the name of this logger.
    std::string getName() const {
      return _name;
    }

    /// Set the name of this logger.
    Log& setName(const std::string& name) {
      _name = name;
      return *this;
    }

    /// Will this log level produce output on this logger at the moment?
    bool isActive(int level) const {
      return (level >= _level);
    }

    /// @name Explicit log methods
    //@{
    void trace(const std::string& message) { log(TRACE, message); }

    void debug(const std::string& message) { log(DEBUG, message); }

    void info(const std::string& message) { log(INFO, message); }

    void warn(const std::string& message) { log(WARN, message); }

    void error(const std::string& message) { log(ERROR, message); }
    //@}

  private:
    /// This logger's name
    std::string _name;

    /// Threshold level for this logger.
    int _level;

  protected:
    /// Write a message at a particular level.
    void log(int level, const std::string& message);

    /// Turn a message string into the current log format.
    std::string formatMessage(int level, const std::string& message);

  public:

    /// A null output stream, used for piping discarded output to nowhere.
    /// @todo Hide this...
    std::ostream* const _nostream;

    /// The streaming operator can use Log's internals.
    friend std::ostream& operator<<(Log& log, int level);

  };

  /// Streaming output to a logger must have a Log::Level/int as its first argument.
  std::ostream& operator<<(Log& log, int level);

}


// Neat CPU-conserving logging macros. Use by preference!
// NB. Only usable in classes where a getLog() method is provided
#define MSG_LVL(lvl, x) \
  do { \
    if (getLog().isActive(lvl)) { \
      getLog() << lvl << x << endl;   \
    } \
  } while (0)

#define MSG_TRACE(x)   MSG_LVL(Log::TRACE, x)
#define MSG_DEBUG(x)   MSG_LVL(Log::DEBUG, x)
#define MSG_INFO(x)    MSG_LVL(Log::INFO, x)
#define MSG_WARNING(x) MSG_LVL(Log::WARNING, x)
#define MSG_ERROR(x)   MSG_LVL(Log::ERROR, x)


#endif