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

Unified Diff: services/log/log_impl.h

Issue 1447273002: Mojo Log service and a thread-safe client library. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: removed environment & bindings changes from previous patchset. remove unused mojo::log::EntryMetad… Created 5 years, 1 month 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: services/log/log_impl.h
diff --git a/services/log/log_impl.h b/services/log/log_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..e633c68209eb1ced3d0f96318e11378bbe0339b2
--- /dev/null
+++ b/services/log/log_impl.h
@@ -0,0 +1,50 @@
+// Copyright 2015 The Chromium 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 SERVICES_LOG_LOG_IMPL_H_
+#define SERVICES_LOG_LOG_IMPL_H_
+
+#include <string>
+
+#include "mojo/public/cpp/bindings/interface_request.h"
+#include "mojo/public/cpp/bindings/strong_binding.h"
+#include "mojo/services/log/interfaces/entry.mojom.h"
+#include "mojo/services/log/interfaces/log.mojom.h"
+
+namespace mojo {
+
+class ApplicationConnection;
+
+namespace log {
+
+// This is an implementation of the log service
+// (see mojo/services/log/interfaces/log.mojom). It only formats incoming
+// messages and prints them to stderr.
+//
+// This service implementation binds a new Log implementation for each incoming
+// application connection.
+class LogImpl : public Log {
+ public:
+ static void Create(ApplicationConnection* connection,
+ InterfaceRequest<Log> request);
+
+ // |Log| implementation:
+ void AddEntry(EntryPtr entry) override;
+
+ private:
+ LogImpl(const std::string& remote_url, InterfaceRequest<Log> request);
+ ~LogImpl() override;
+
+ std::string FormatEntry(const EntryPtr& entry);
+
+ const std::string remote_url_;
+ StrongBinding<Log> binding_;
+
+ MOJO_DISALLOW_COPY_AND_ASSIGN(LogImpl);
+};
+
+} // namespace log
+} // namespace mojo
+
+#endif // SERVICES_LOG_LOG_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698