/usr/include/wreport/notes.h is in libwreport-dev 3.6-1build2.
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 | #ifndef WREPORT_NOTES_H
#define WREPORT_NOTES_H
#include <iosfwd>
#ifndef WREPORT_PRINTF_ATTRS
#define WREPORT_PRINTF_ATTRS(a, b) __attribute__ ((format(printf, a, b)))
#endif
namespace wreport {
/**
* Collect notes about unusual things that happen during processing.
*
* By default notes are discarded, unless set_target() is called or a
* notes::Collect object is instantiated to direct notes where needed.
*/
namespace notes {
/// Set the target stream where the notes are sent
void set_target(std::ostream& out);
/// Get the current target stream for notes
std::ostream* get_target();
/// Return true if there is any target to which notes are sent
bool logs() throw ();
/// Output stream to send notes to
std::ostream& log() throw ();
/// printf-style logging
void logf(const char* fmt, ...) WREPORT_PRINTF_ATTRS(1, 2);
/**
* RAII way to temporarily set a notes target.
*
* Notes are sent to the given output stream for as long as the object is in
* scope.
*/
struct Collect
{
/**
* Old target stream to be restored whemn the object goes out of scope
*/
std::ostream* old;
/// Direct notes to \a out for the lifetime of the object
Collect(std::ostream& out)
{
old = get_target();
set_target(out);
}
~Collect()
{
set_target(*old);
}
};
}
}
#endif
|