1
// Copyright 2010 Google Inc.
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
7
// http://www.apache.org/licenses/LICENSE-2.0
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
15
// Author: sligocki@google.com (Shawn Ligocki)
17
#ifndef NET_INSTAWEB_APACHE_APACHE_MESSAGE_HANDLER_H_
18
#define NET_INSTAWEB_APACHE_APACHE_MESSAGE_HANDLER_H_
22
#include "net/instaweb/system/public/system_message_handler.h"
23
#include "net/instaweb/util/public/basictypes.h"
24
#include "net/instaweb/util/public/message_handler.h"
25
#include "net/instaweb/util/public/string.h"
26
#include "net/instaweb/util/public/string_util.h"
30
namespace net_instaweb {
35
// Implementation of an HTML parser message handler that uses Apache
36
// logging to emit messsages.
37
class ApacheMessageHandler : public SystemMessageHandler {
39
// version is a string added to each message.
40
// Timer is used to generate timestamp for messages in shared memory.
41
ApacheMessageHandler(const server_rec* server, const StringPiece& version,
42
Timer* timer, AbstractMutex* mutex);
44
// Installs a signal handler for common crash signals that tries to print
46
static void InstallCrashHandler(server_rec* global_server);
49
virtual void MessageVImpl(MessageType type, const char* msg, va_list args);
51
virtual void FileMessageVImpl(MessageType type, const char* filename,
52
int line, const char* msg, va_list args);
55
int GetApacheLogLevel(MessageType type);
57
const server_rec* server_rec_;
58
const GoogleString version_;
60
DISALLOW_COPY_AND_ASSIGN(ApacheMessageHandler);
63
} // namespace net_instaweb
65
#endif // NET_INSTAWEB_APACHE_APACHE_MESSAGE_HANDLER_H_