/usr/include/wreport/notes.h is in libwreport-dev 2.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 | /*
* wreport/notes - Collect notes about unusual processing
*
* Copyright (C) 2011 ARPA-SIM <urpsim@smr.arpa.emr.it>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Author: Enrico Zini <enrico@enricozini.com>
*/
#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);
}
};
}
}
/* vim:set ts=4 sw=4: */
#endif
|