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 syslog_logging { |
| 11 // Initialize logging subsystem. |log_to_stderr_too| causes logs to |
| 12 // go to stderr as well as syslog. |
| 13 void InitLogging(bool log_to_syslog, bool log_to_stderr); |
| 14 // Convenience function for configuring syslog via openlog. Users |
| 15 // could call openlog directly except for naming collisions between |
| 16 // base/logging.h and syslog.h. Similarly users cannot pass the |
| 17 // normal parameters so we pick a representative set. |log_pid| |
| 18 // causes pid to be logged with |ident|. |
| 19 void OpenLog(const char* ident, bool log_pid); |
| 20 // Start accumulating the logs to a string. This is inefficient, so |
| 21 // do not set to true if large numbers of log messages are coming. |
| 22 // Accumulated logs are only ever cleared when the clear function is |
| 23 // called. |
| 24 void AccumulateToString(bool accumulate); |
| 25 // Get the accumulated logs as a string. |
| 26 std::string GetAccumulatedLogging(); |
| 27 // Clear the accumulated logs. |
| 28 void ClearAccumulatedLog(); |
| 29 // Returns true if the accumulated log contains the given string. Useful |
| 30 // for testing. |
| 31 bool Contains(const char* string); |
| 32 } // namespace syslog_logging |
| 33 |
| 34 #endif // CHROMEOS_SYSLOG_LOGGING_H_ |
OLD | NEW |