Backed out changeset bd51857879db (bug 1862957) for causing WakeLock related failures...
[gecko.git] / xpcom / base / LogCommandLineHandler.h
blobef945d7980b69ef13e59cde0ab5d8465b6f0ce2e
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 LogCommandLineHandler_h
8 #define LogCommandLineHandler_h
10 #include <functional>
11 #include "nsString.h"
13 namespace mozilla {
15 /**
16 * A helper function parsing provided command line arguments and handling two
17 * specific args:
19 * -MOZ_LOG=modulelist
20 * -MOZ_LOG_FILE=file/path
22 * both expecting an argument, and corresponding to the same-name environment
23 * variables we use for logging setup.
25 * When an argument is found in the proper form, the consumer callback is called
26 * with a string in a follwing form, note that we do this for every occurence,
27 * and not just at the end of the parsing:
29 * "MOZ_LOG=modulelist" or "MOZ_LOG_FILE=file/path"
31 * All the following forms of arguments of the application are possible:
33 * --MOZ_LOG modulelist
34 * -MOZ_LOG modulelist
35 * --MOZ_LOG=modulelist
36 * -MOZ_LOG=modulelist
38 * The motivation for a separte function and not implementing a command line
39 * handler interface is that we need to process this very early during the
40 * application startup. Command line handlers are proccessed way later
41 * after logging has already been set up.
43 void LoggingHandleCommandLineArgs(
44 int argc, char const* const* argv,
45 std::function<void(nsACString const&)> const& consumer);
47 } // namespace mozilla
49 #endif