Lingua-Identify-CLD
view release on metacpan or search on metacpan
cld-src/base/logging.h view on Meta::CPAN
if (message_length > 0) { \
LogMessage(__FILE__, __LINE__, ERROR, 0, \
&LogMessage::SendToLog).stream() << message; \
LocalFree(message); \
} \
}
#endif
// We use the preprocessor's merging operator, "##", so that, e.g.,
// LOG(INFO) becomes the token GOOGLE_LOG_INFO. There's some funny
// subtle difference between ostream member streaming functions (e.g.,
// ostream::operator<<(int) and ostream non-member streaming functions
// (e.g., ::operator<<(ostream&, string&): it turns out that it's
// impossible to stream something like a string directly to an unnamed
// ostream. We employ a neat hack by calling the stream() member
// function of LogMessage which seems to avoid the problem.
#define LOG(severity) COMPACT_GOOGLE_LOG_ ## severity.stream()
#define SYSLOG(severity) SYSLOG_ ## severity(0).stream()
// A convenient shorthand
#define LG LOG(INFO)
cld-src/base/logging.h view on Meta::CPAN
// #define MODULE_FLAG FLAGS_dnsverbose
#define MLOG(verboselevel) LOG_IF(INFO, MODULE_FLAG >= (verboselevel))
// Redefine the standard assert to use our nice log files
#undef assert
#define assert(x) DLOG_ASSERT(x)
//
// This class more or less represents a particular log message. You
// create an instance of LogMessage and then stream stuff to it.
// When you finish streaming to it, ~LogMessage is called and the
// full message gets streamed to the appropriate destination.
//
// You shouldn't actually use LogMessage's constructor to log things,
// though. You should use the LOG() macro (and variants thereof)
// above.
class LogMessage {
public:
enum {
// Passing kNoLogPrefix for the line number disables the
// log-message prefix. Useful for using the LogMessage
cld-src/base/logging.h view on Meta::CPAN
LogMessage(const char* file, int line, const CheckOpString& result);
~LogMessage();
// Flush a buffered message to the sink set in the constructor. Always
// called by the destructor, it may also be called from elsewhere if
// needed. Only the first call is actioned; any later ones are ignored.
void Flush();
// An arbitrary limit on the length of a single log message. This
// is so that streaming can be done more efficiently.
static const size_t kMaxLogMessageLen;
// Theses should not be called directly outside of logging.*,
// only passed as SendMethod arguments to other LogMessage methods:
void SendToLog(); // Actually dispatch to the logs
void SendToSyslogAndLog(); // Actually dispatch to syslog and the logs
// Call abort() or similar to perform LOG(FATAL) crash.
// Writes current stack trace to stderr.
static void Fail() ATTRIBUTE_NORETURN;
( run in 0.242 second using v1.01-cache-2.11-cpan-4d50c553e7e )