tl;dr - PR_LOG* are deprecated. Use MOZ_LOG* instead.
As part of the effort to improving logging in gecko we've started a transition
to using a MOZ prefix and a new set of log levels [1]. I've just landed these
changes on mozilla-inbound, if they stick this means you should no longer use
PR_LOG and friends (and in most cases it won't work as we explicitly undef them
in mozilla/Logging.h).
A quick transition guide:
- #include "prlog.h" => #include "mozilla/Logging.h"
- PR_LOG => MOZ_LOG
- PR_LOG_TEST => MOZ_LOG_TEST
Additionally we have moved to using an enum class to specify log levels. This
means that using integer constants to represent log levels in code no longer
works, nor can you create pseudo log levels (such as, lets say, PR_LOG_DEBUG +
2).
After some rather thorough discussion [2] we have settled on an enum class that
provides a pretty decent mapping to the previous PR_LOG levels:
enum class LogLevel {
Disabled = 0,
Error,
Warning,
Info,
Debug,
Verbose,
};
Of note:
- PR_LOG_ALWAYS was removed, usage was mostly transitioned to the new Info
log level.
- Verbose was added and instances of PR_LOG_DEBUG + 1 were replaced with it
- PR_LOG_ERROR mapped to level 2, Error maps to level 1
- PR_LOG_WARNING mapped to level 3, Warning maps to level 2
Additionally, please note, there is now an Info level. This should probably be
the default output level for most messages, but, of course, which log level to
use is left to the discretion of the developer.
Also as previously noted [3]: please stop using |#ifdef PR_LOGGING|, PR_LOGGING
is always enabled. Such usage has no effect and is misleading.
[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1165515
[2] https://groups.google.com/forum/#!topic/mozilla.dev.platform/t9cDvC8LHsM
[3] https://groups.google.com/forum/#!topic/mozilla.dev.platform/JNN0T07y_ww
_______________________________________________
dev-platform mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-platform