This file is indexed.

/usr/include/libcgroup/log.h is in libcgroup-dev 0.41-7ubuntu1.

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
#ifndef _LIBCGROUP_LOG_H
#define _LIBCGROUP_LOG_H

#ifndef _LIBCGROUP_H_INSIDE
#error "Only <libcgroup.h> should be included directly."
#endif

#ifndef SWIG
#include <features.h>
#endif

#include <stdarg.h>

__BEGIN_DECLS

/**
 * @defgroup group_log 7. Logging
 * @{
 *
 * @name Logging
 * @{
 * Libcgroup allows applications to register a callback function which
 * libcgroup will call when it wants to log something. Each log message
 * has associated a log level. As described in previous chapter, most libcgroup
 * functions return an error code, which described root cause of the failure
 * and log messages might provide further details about these failures and other
 * notable events.
 *
 * @par
 * The logging callback can be set at any time, but setting the callback before
 * any other libcgroup function (including cgroup_init()) is highly recommended.
 * If no logger is set before cgroup_init() is called, default logger is
 * automatically set, logging CGROUP_LOG_ERROR messages to stdout.
 *
 * @par Setting log level
 * Some of the functions below set the log level as integer.
 * Application can set directly a value of enum #cgroup_log_level or use
 * value <tt>-1</tt> to set the log level automatically. In this case, libcgroup
 * inspects environment variable <tt>CGROUP_LOGLEVEL</tt> if it is set
 * and contains any of these values: <tt>ERROR</tt>, <tt>WARNING</tt>,
 * <tt>INFO</tt>, <tt>DEBUG</tt> or integer number representing value from
 * enum #cgroup_log_level. If <tt>CGROUP_LOGLEVEL</tt> is not set or its value
 * is not valid, <tt>CGROUP_LOG_ERROR</tt> is set as default log level.
 *
 * @par Example:
 * Following short example shows custom libcgroup logger sending all log
 * messages to <tt>stderr</tt>:
 * @code
 * static void my_logger(void *userdata, int level, const char *fmt, va_list ap)
 * {
 *	vfprintf(stderr, fmt, ap);
 * }
 *
 * int main(int argc, char **argv)
 * {
 *	int ret;
 *
 *	cgroup_set_logger(my_logger, -1, NULL);
 *	ret = cgroup_init();
 *	if (ret) {
 *		...
 *	}
 *	...
 * @endcode
 */

/**
 * Level of importance of a log message.
 */
enum cgroup_log_level {
	/**
	 * Something serious happened and libcgroup failed to perform requested
	 * operation.
	 */
	CGROUP_LOG_ERROR = 1,
	/**
	 * Something bad happened but libcgroup recovered from the error.
	 */
	CGROUP_LOG_WARNING,
	/**
	 * Something interesting happened and the message might be useful to the
	 * user.
	 */
	CGROUP_LOG_INFO,
	/**
	 * Debugging messages useful to libcgroup developers.
	 */
	CGROUP_LOG_DEBUG,
};

typedef void (*cgroup_logger_callback)(void *userdata, int level,
		const char *fmt, va_list ap);

/**
 * Set libcgroup logging callback. All log messages with equal or lower log
 * level will be sent to the application's callback. There can be only
 * one callback logger set, the previous callback is replaced with the new one
 * by calling this function.
 * Use NULL as the logger callback to completely disable libcgroup logging.
 *
 * @param logger The callback.
 * @param loglevel The log level. Use value -1 to automatically discover the
 * level from CGROUP_LOGLEVEL environment variable.
 * @param userdata Application's data which will be provided back to the
 * callback.
 */
extern void cgroup_set_logger(cgroup_logger_callback logger, int loglevel,
		void *userdata);

/**
 * Set libcgroup logging to stdout. All messages with the given loglevel
 * or below will be sent to standard output. Previous logger set by
 * cgroup_set_logger() is replaced.
 *
 * @param loglevel The log level. Use value -1 to automatically discover the
 * level from CGROUP_LOGLEVEL environment variable.
 */
extern void cgroup_set_default_logger(int loglevel);

/**
 * Change current loglevel.
 * @param loglevel The log level. Use value -1 to automatically discover the
 * level from CGROUP_LOGLEVEL environment variable.
 */
extern void cgroup_set_loglevel(int loglevel);

/**
 * Libcgroup log function. This is for applications which are too lazy to set
 * up their own complex logging and miss-use libcgroup for that purpose.
 * I.e. this function should be used only by simple command-line tools.
 * This logging automatically benefits from CGROUP_LOGLEVEL env. variable.
 */
extern void cgroup_log(int loglevel, const char *fmt, ...);

/**
 * Parse levelstr string for information about desired loglevel. The levelstr
 * is usually a value of the CGROUP_LOGLEVEL environment variable.
 * @param levelstr String containing desired loglevel.
 */
extern int cgroup_parse_log_level_str(const char *levelstr);
/**
 * @}
 * @}
 */
__END_DECLS

#endif /* _LIBCGROUP_LOG_H */