Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8413)

Unified Diff: chromeos/syslog_logging.h

Issue 6597120: libchromeos: re-push add process control library, syslog logging capability, and run unit tests (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/common.git@master
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/process_test.cc ('k') | chromeos/syslog_logging.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/syslog_logging.h
diff --git a/chromeos/syslog_logging.h b/chromeos/syslog_logging.h
new file mode 100644
index 0000000000000000000000000000000000000000..179b9fa31a777a7377f900d13ddc4cbe720c12e5
--- /dev/null
+++ b/chromeos/syslog_logging.h
@@ -0,0 +1,40 @@
+// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROMEOS_SYSLOG_LOGGING_H_
+#define CHROMEOS_SYSLOG_LOGGING_H_
+
+#include <string>
+
+namespace chromeos {
+
+enum InitFlags {
+ kLogToSyslog = 1,
+ kLogToStderr = 2
+};
+
+// Initialize logging subsystem. |flags| indicates
+void InitLog(int init_flags);
+// Convenience function for configuring syslog via openlog. Users
+// could call openlog directly except for naming collisions between
+// base/logging.h and syslog.h. Similarly users cannot pass the
+// normal parameters so we pick a representative set. |log_pid|
+// causes pid to be logged with |ident|.
+void OpenLog(const char* ident, bool log_pid);
+// Start accumulating the logs to a string. This is inefficient, so
+// do not set to true if large numbers of log messages are coming.
+// Accumulated logs are only ever cleared when the clear function ings
+// called.
+void LogToString(bool enabled);
+// Get the accumulated logs as a string.
+std::string GetLog();
+// Clear the accumulated logs.
+void ClearLog();
+// Returns true if the accumulated log contains the given string. Useful
+// for testing.
+bool FindLog(const char* string);
+
+} // namespace chromeos
+
+#endif // CHROMEOS_SYSLOG_LOGGING_H_
« no previous file with comments | « chromeos/process_test.cc ('k') | chromeos/syslog_logging.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698