/usr/include/ui-utilcpp/SysLogMono.hpp is in libui-utilcpp-dev 1.8.3-3.
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 | /**
* @file SysLogMono.hpp
* @author Schlund + Partner AG
* @brief Syslog Mono Log: Singleton logger using syslog() for mono threaded applications
* @see SMLogMono.hpp
*
* Synopsis:
* @code
* #include <ui-utilcpp/SMLogMono.hpp>
* @endcode
*
*/
#ifndef UI_UTIL_SYSLOGMONO_HPP
#define UI_UTIL_SYSLOGMONO_HPP
// STDC++
#include <string>
#include <iostream>
// POSIX C
#include <syslog.h>
namespace UI {
namespace Util {
/** @brief C++ Abstraction of syslog(3) for mono threaded applications. */
class SysLogMono: public std::streambuf, public std::ostream
{
public:
/**
* @param ident Identifier (prefix) for the log lines.
* @param option Options as described in syslog(3).
* @param facility Facility as described in syslog(3).
*/
SysLogMono(std::string const & ident, int option, int facility);
/** @brief Destructor. */
~SysLogMono();
/** @brief Log operator.
*
* @param level Log level as described in syslog(3).
*/
SysLogMono & operator() (int level);
private:
int overflow(int c);
std::string const ident_;
std::string buf_;
int level_;
};
/** @brief Singleton class holding one SysLogMono object. */
class SysLogMonoSingleton
{
public:
/**
* @param ident Identifier (prefix) for the log lines.
* @param option Options as described in syslog(3).
* @param facility Facility as described in syslog(3).
*/
SysLogMonoSingleton(std::string const & ident, int option, int facility);
/** */
~SysLogMonoSingleton();
/** @brief Log function; you may stream directly into the result.
*
* @param level Log level as described in syslog(3).
* @returns SysLogMono stream ready to stream into.
*/
static SysLogMono & log(int level);
private:
static SysLogMono * singleton_;
};
}}
#endif
|