2012-10-02 20:04:58 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
// Original author: ekr@rtfm.com
|
|
|
|
|
|
|
|
#ifndef logging_h__
|
|
|
|
#define logging_h__
|
|
|
|
|
2013-05-21 02:11:01 +00:00
|
|
|
#include <sstream>
|
2015-05-19 18:15:34 +00:00
|
|
|
#include "mozilla/Logging.h"
|
2012-10-02 20:04:58 +00:00
|
|
|
|
2015-06-03 22:25:57 +00:00
|
|
|
#define ML_ERROR mozilla::LogLevel::Error
|
|
|
|
#define ML_WARNING mozilla::LogLevel::Warning
|
|
|
|
#define ML_NOTICE mozilla::LogLevel::Info
|
|
|
|
#define ML_INFO mozilla::LogLevel::Debug
|
|
|
|
#define ML_DEBUG mozilla::LogLevel::Verbose
|
2013-07-03 18:40:36 +00:00
|
|
|
|
2012-10-02 20:04:58 +00:00
|
|
|
#define MOZ_MTLOG_MODULE(n) \
|
2012-11-08 18:44:41 +00:00
|
|
|
static PRLogModuleInfo* getLogModule() { \
|
|
|
|
static PRLogModuleInfo* log; \
|
|
|
|
if (!log) \
|
|
|
|
log = PR_NewLogModule(n); \
|
|
|
|
return log; \
|
|
|
|
}
|
2012-10-02 20:04:58 +00:00
|
|
|
|
|
|
|
#define MOZ_MTLOG(level, b) \
|
2013-01-30 21:13:38 +00:00
|
|
|
do { \
|
2015-06-03 22:22:28 +00:00
|
|
|
if (MOZ_LOG_TEST(getLogModule(), level)) { \
|
2015-05-14 17:13:24 +00:00
|
|
|
std::stringstream str; \
|
|
|
|
str << b; \
|
2015-05-21 20:22:04 +00:00
|
|
|
MOZ_LOG(getLogModule(), level, ("%s", str.str().c_str())); \
|
2015-05-14 17:13:24 +00:00
|
|
|
} \
|
|
|
|
} while(0)
|
2012-11-08 18:44:41 +00:00
|
|
|
|
2013-01-30 21:13:38 +00:00
|
|
|
#endif // logging_h__
|