19 #ifndef PAGESPEED_KERNEL_BASE_MESSAGE_HANDLER_H_
20 #define PAGESPEED_KERNEL_BASE_MESSAGE_HANDLER_H_
28 namespace net_instaweb {
55 void Message(MessageType type,
const char* msg, ...)
57 void MessageV(MessageType type, const
char* msg, va_list args);
60 void FileMessage(MessageType type, const
char* filename,
int line,
62 void FileMessageV(MessageType type, const
char* filename,
int line,
63 const
char* msg, va_list args);
66 void Check(
bool condition, const
char* msg, ...) INSTAWEB_PRINTF_FORMAT(3, 4);
67 void CheckV(
bool condition, const
char* msg, va_list args);
73 void Info(const
char* filename,
int line, const
char* msg, ...)
74 INSTAWEB_PRINTF_FORMAT(4, 5);
75 void Warning(const
char* filename,
int line, const
char* msg, ...)
76 INSTAWEB_PRINTF_FORMAT(4, 5);
77 void Error(const
char* filename,
int line, const
char* msg, ...)
78 INSTAWEB_PRINTF_FORMAT(4, 5);
79 void FatalError(const
char* filename,
int line, const
char* msg, ...)
80 INSTAWEB_PRINTF_FORMAT(4, 5);
82 void InfoV(const
char* filename,
int line, const
char* msg, va_list args) {
83 FileMessageV(kInfo, filename, line, msg, args);
85 void WarningV(
const char* filename,
int line,
const char* msg, va_list a) {
86 FileMessageV(kWarning, filename, line, msg, a);
88 void ErrorV(
const char* filename,
int line,
const char* msg, va_list args) {
89 FileMessageV(kError, filename, line, msg, args);
91 void FatalErrorV(
const char* fname,
int line,
const char* msg, va_list a) {
92 FileMessageV(kFatal, fname, line, msg, a);
98 void FileMessageS(MessageType type,
const char* filename,
int line,
104 virtual bool Dump(Writer* writer);
108 StringPiece message_dump, StringPieceVector* messages);
119 virtual void MessageVImpl(MessageType type,
const char* msg,
121 virtual void FileMessageVImpl(MessageType type,
const char* filename,
122 int line,
const char* msg, va_list args);
127 virtual void FileMessageSImpl(
128 MessageType type,
const char* filename,
int line,
136 MessageType min_message_type_;
140 #define PS_LOG_INFO(handler, ...) \
141 (handler)->Info(__FILE__, __LINE__, __VA_ARGS__)
142 #define PS_LOG_WARN(handler, ...) \
143 (handler)->Warning(__FILE__, __LINE__, __VA_ARGS__)
144 #define PS_LOG_ERROR(handler, ...) \
145 (handler)->Error(__FILE__, __LINE__, __VA_ARGS__)
146 #define PS_LOG_FATAL(handler, ...) \
147 (handler)->FatalError(__FILE__, __LINE__, __VA_ARGS__)
150 #define PS_LOG_DFATAL(handler, ...) \
151 PS_LOG_FATAL(handler, __VA_ARGS__)
153 #define PS_LOG_DFATAL(handler, ...) \
154 PS_LOG_ERROR(handler, __VA_ARGS__)
160 #define PS_DLOG_INFO(handler, ...) \
161 PS_LOG_INFO(handler, __VA_ARGS__)
162 #define PS_DLOG_WARN(handler, ...) \
163 PS_LOG_WARN(handler, __VA_ARGS__)
164 #define PS_DLOG_ERROR(handler, ...) \
165 PS_LOG_ERROR(handler, __VA_ARGS__)
167 inline void NoOpMacroPlaceholder() {}
172 #define PS_DLOG_INFO(handler, ...) ::net_instaweb::NoOpMacroPlaceholder()
173 #define PS_DLOG_WARN(handler, ...) ::net_instaweb::NoOpMacroPlaceholder()
174 #define PS_DLOG_ERROR(handler, ...) ::net_instaweb::NoOpMacroPlaceholder()
void Check(bool condition, const char *msg,...) INSTAWEB_PRINTF_FORMAT(3
Conditional errors.
virtual void MessageSImpl(MessageType type, const GoogleString &message)=0
void FileMessage(MessageType type, const char *filename, int line, const char *msg,...) INSTAWEB_PRINTF_FORMAT(5
Log a message with a filename and line number attached.
void Info(const char *filename, int line, const char *msg,...) INSTAWEB_PRINTF_FORMAT(4
virtual void ParseMessageDumpIntoMessages(StringPiece message_dump, StringPieceVector *messages)
Parse the dumped log into messages.
void MessageS(MessageType type, const GoogleString &message)
const char * MessageTypeToString(const MessageType type) const
String representation for MessageType.
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
virtual bool Dump(Writer *writer)
virtual StringPiece ReformatMessage(StringPiece message)
Make the message look more readable when rendering to history page.
virtual MessageType GetMessageType(StringPiece message)
Return the message type.
void Message(MessageType type, const char *msg,...) INSTAWEB_PRINTF_FORMAT(3
Log an info, warning, error or fatal error message.
void set_min_message_type(MessageType min)
Definition: message_handler.h:52
void FormatTo(GoogleString *buffer, const char *msg, va_list args)
FormatTo appends to *buffer.
Definition: message_handler.h:39
virtual void MessageVImpl(MessageType type, const char *msg, va_list args)
static MessageType StringToMessageType(const StringPiece &msg)
Convert string to MessageType.