OLD | NEW |
| (Empty) |
1 // 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 | |
5 #ifndef CHROMEOS_SYSLOG_LOGGING_H_ | |
6 #define CHROMEOS_SYSLOG_LOGGING_H_ | |
7 | |
8 #include <string> | |
9 | |
10 namespace chromeos { | |
11 | |
12 enum InitFlags { | |
13 kLogToSyslog = 1, | |
14 kLogToStderr = 2 | |
15 }; | |
16 | |
17 // Initialize logging subsystem. |flags| indicates | |
18 void InitLog(int init_flags); | |
19 // Convenience function for configuring syslog via openlog. Users | |
20 // could call openlog directly except for naming collisions between | |
21 // base/logging.h and syslog.h. Similarly users cannot pass the | |
22 // normal parameters so we pick a representative set. |log_pid| | |
23 // causes pid to be logged with |ident|. | |
24 void OpenLog(const char* ident, bool log_pid); | |
25 // Start accumulating the logs to a string. This is inefficient, so | |
26 // do not set to true if large numbers of log messages are coming. | |
27 // Accumulated logs are only ever cleared when the clear function ings | |
28 // called. | |
29 void LogToString(bool enabled); | |
30 // Get the accumulated logs as a string. | |
31 std::string GetLog(); | |
32 // Clear the accumulated logs. | |
33 void ClearLog(); | |
34 // Returns true if the accumulated log contains the given string. Useful | |
35 // for testing. | |
36 bool FindLog(const char* string); | |
37 | |
38 } // namespace chromeos | |
39 | |
40 #endif // CHROMEOS_SYSLOG_LOGGING_H_ | |
OLD | NEW |