blob: e75708cb0b0ffcf99304d66d843c9c913945e147 [file] [log] [blame]
Paul Stewart75897df2011-04-27 09:05:53 -07001// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Chris Masone0e1d1042011-05-09 18:07:03 -07005#include <base/at_exit.h>
Darin Petkov35694152011-08-17 16:55:04 -07006#include <base/command_line.h>
7#include <chromeos/syslog_logging.h>
Paul Stewart75897df2011-04-27 09:05:53 -07008#include <gtest/gtest.h>
Paul Stewart75897df2011-04-27 09:05:53 -07009
Prathmesh Prabhuf002cdb2014-09-17 22:41:05 -070010#include "shill/logging.h"
11
12namespace switches {
13
14static const char kHelp[] = "help";
15
16static const char kHelpMessage[] = "\n"
17 "Additional (non-gtest) switches:\n"
18 " --log-level=N\n"
19 " Logging level:\n"
20 " 0 = LOG(INFO), 1 = LOG(WARNING), 2 = LOG(ERROR),\n"
21 " -1 = SLOG(..., 1), -2 = SLOG(..., 2), etc.\n"
22 " --log-scopes=\"*scope1+scope2\".\n"
23 " Scopes to enable for SLOG()-based logging.\n";
24
25} // namespace switches
26
Paul Stewart75897df2011-04-27 09:05:53 -070027int main(int argc, char** argv) {
Chris Masone0e1d1042011-05-09 18:07:03 -070028 base::AtExitManager exit_manager;
Alex Vakulenko127f2562015-04-02 14:31:10 -070029 base::CommandLine::Init(argc, argv);
Paul Stewart1a212a62015-06-16 13:13:10 -070030 base::CommandLine* cl = base::CommandLine::ForCurrentProcess();
Darin Petkov35694152011-08-17 16:55:04 -070031 chromeos::InitLog(chromeos::kLogToStderr);
Prathmesh Prabhuf002cdb2014-09-17 22:41:05 -070032 shill::SetLogLevelFromCommandLine(cl);
Paul Stewart75897df2011-04-27 09:05:53 -070033 ::testing::InitGoogleTest(&argc, argv);
Prathmesh Prabhuf002cdb2014-09-17 22:41:05 -070034
35 if (cl->HasSwitch(switches::kHelp)) {
36 std::cerr << switches::kHelpMessage;
37 }
Peter Qiu40a01482014-10-31 11:54:23 -070038
Paul Stewart75897df2011-04-27 09:05:53 -070039 return RUN_ALL_TESTS();
40}