Page Speed Optimization Libraries
1.7.30.4
|
00001 // Copyright 2010 Google Inc. 00014 00016 00017 #ifndef NET_INSTAWEB_APACHE_APACHE_MESSAGE_HANDLER_H_ 00018 #define NET_INSTAWEB_APACHE_APACHE_MESSAGE_HANDLER_H_ 00019 00020 #include <cstdarg> 00021 00022 #include "net/instaweb/util/public/basictypes.h" 00023 #include "net/instaweb/util/public/google_message_handler.h" 00024 #include "net/instaweb/util/public/message_handler.h" 00025 #include "net/instaweb/util/public/scoped_ptr.h" 00026 #include "net/instaweb/util/public/string.h" 00027 #include "net/instaweb/util/public/string_util.h" 00028 00029 struct server_rec; 00030 00031 namespace net_instaweb { 00032 00033 class AbstractMutex; 00034 class SharedCircularBuffer; 00035 class Timer; 00036 class Writer; 00037 00040 class ApacheMessageHandler : public MessageHandler { 00041 public: 00044 ApacheMessageHandler(const server_rec* server, const StringPiece& version, 00045 Timer* timer, AbstractMutex* mutex); 00046 00049 static void InstallCrashHandler(server_rec* global_server); 00050 00054 void set_buffer(SharedCircularBuffer* buff); 00055 void SetPidString(const int64 pid) { 00056 pid_string_ = StrCat("[", Integer64ToString(pid), "]"); 00057 } 00059 virtual bool Dump(Writer* writer); 00060 00061 protected: 00062 virtual void MessageVImpl(MessageType type, const char* msg, va_list args); 00063 00064 virtual void FileMessageVImpl(MessageType type, const char* filename, 00065 int line, const char* msg, va_list args); 00066 00067 private: 00068 int GetApacheLogLevel(MessageType type); 00069 00070 const server_rec* server_rec_; 00071 const GoogleString version_; 00074 Timer* timer_; 00075 scoped_ptr<AbstractMutex> mutex_; 00077 GoogleString pid_string_; 00082 GoogleMessageHandler handler_; 00083 SharedCircularBuffer* buffer_; 00084 00085 DISALLOW_COPY_AND_ASSIGN(ApacheMessageHandler); 00086 }; 00087 00088 } 00089 00090 #endif ///< NET_INSTAWEB_APACHE_APACHE_MESSAGE_HANDLER_H_