1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef LayoutLogging_h
8 #define LayoutLogging_h
10 #include "mozilla/Logging.h"
13 * Retrieves the log module to use for layout logging.
15 static mozilla::LazyLogModule
sLayoutLog("layout");
18 * Use the layout log to warn if a given condition is false.
20 * This is only enabled in debug builds and the logging is only displayed if
21 * the environmental variable MOZ_LOG includes "layout:2" (or higher).
24 # define LAYOUT_WARN_IF_FALSE(_cond, _msg) \
26 if (MOZ_LOG_TEST(sLayoutLog, mozilla::LogLevel::Warning) && !(_cond)) { \
27 mozilla::detail::LayoutLogWarning(_msg, #_cond, __FILE__, __LINE__); \
31 # define LAYOUT_WARN_IF_FALSE(_cond, _msg) \
37 * Use the layout log to emit a warning with the same format as NS_WARNING.
39 * This is only enabled in debug builds and the logging is only displayed if
40 * the environmental variable MOZ_LOG includes "layout:2" (or higher).
43 # define LAYOUT_WARNING(_msg) \
45 if (MOZ_LOG_TEST(sLayoutLog, mozilla::LogLevel::Warning)) { \
46 mozilla::detail::LayoutLogWarning(_msg, nullptr, __FILE__, __LINE__); \
50 # define LAYOUT_WARNING(_msg) \
58 void LayoutLogWarning(const char* aStr
, const char* aExpr
, const char* aFile
,
62 } // namespace mozilla
64 #endif // LayoutLogging_h