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

Unified Diff: remoting/host/logging_mac.cc

Issue 2034393004: Allow multiple logging::LogMessage{Handler,Listener}s Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clean up, MockLog uses listener Created 4 years, 5 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
Index: remoting/host/logging_mac.cc
diff --git a/remoting/host/logging_mac.cc b/remoting/host/logging_mac.cc
index 39e007d409b528d5fe9b38307afe9ebc84dd8d94..8d653845214580c5e34b052648eef801ebac065b 100644
--- a/remoting/host/logging_mac.cc
+++ b/remoting/host/logging_mac.cc
@@ -33,7 +33,7 @@ typedef base::ScopedGeneric<aslmsg, ScopedAslMsgTraits> ScopedAslMsg;
// Logging message handler that writes to syslog.
// The log can be obtained by running the following in a terminal:
// syslog -k Facility org.chromium.chromoting
-bool LogMessageToAsl(
+void LogMessageToAsl(
logging::LogSeverity severity,
const char* file,
int line,
@@ -60,29 +60,28 @@ bool LogMessageToAsl(
ScopedAslMsg asl_message(asl_new(ASL_TYPE_MSG));
if (!asl_message.is_valid())
- return false;
+ return;
if (asl_set(asl_message.get(), ASL_KEY_FACILITY,
kChromotingLoggingFacility) != 0)
- return false;
+ return;
if (asl_set(asl_message.get(), ASL_KEY_LEVEL,
base::IntToString(level).c_str()) != 0)
- return false;
+ return;
// Restrict read access to the message to root and the current user.
if (asl_set(asl_message.get(), ASL_KEY_READ_UID,
base::IntToString(geteuid()).c_str()) != 0)
- return false;
+ return;
if (asl_set(asl_message.get(), ASL_KEY_MSG,
message.c_str() + message_start) != 0)
- return false;
+ return;
asl_send(nullptr, asl_message.get());
// Don't prevent message from being logged by traditional means.
- return false;
}
} // namespace
@@ -94,7 +93,7 @@ void InitHostLogging() {
logging::InitLogging(settings);
// Write logs to syslog as well.
- logging::SetLogMessageHandler(LogMessageToAsl);
+ logging::AddLogMessageListener(LogMessageToAsl);
}
} // namespace remoting

Powered by Google App Engine
This is Rietveld 408576698