1 // Copyright (c) 2013 The Chromium 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.
5 #ifndef CHROME_TEST_CHROMEDRIVER_CHROME_LOG_H_
6 #define CHROME_TEST_CHROMEDRIVER_CHROME_LOG_H_
10 #include "base/compiler_specific.h"
11 #include "base/time/time.h"
17 // Abstract class for logging entries with a level, timestamp, string message.
20 // Log entry severity level.
32 // Adds an entry to the log.
33 virtual void AddEntryTimestamped(const base::Time& timestamp,
35 const std::string& source,
36 const std::string& message) = 0;
38 // Adds an entry to the log, timestamped with the current time.
39 void AddEntry(Level level,
40 const std::string& source,
41 const std::string& message);
43 // Adds an entry to the log, timestamped with the current time and no source.
44 void AddEntry(Level level, const std::string& message);
47 typedef bool (*IsVLogOnFunc)(int vlog_level);
48 void InitLogging(IsVLogOnFunc is_vlog_on_func);
50 // Returns whether the given VLOG level is on.
51 bool IsVLogOn(int vlog_level);
53 std::string PrettyPrintValue(const base::Value& value);
55 // Returns a pretty printed value, after truncating long strings.
56 std::string FormatValueForDisplay(const base::Value& value);
58 // Returns a pretty printed json string, after truncating long strings.
59 std::string FormatJsonForDisplay(const std::string& json);
61 #endif // CHROME_TEST_CHROMEDRIVER_CHROME_LOG_H_