OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This is a client library that constructs a MojoLogger that can talk to a | 5 // This is a client library that constructs a MojoLogger that can talk to a |
6 // Mojo logging service (see ../interfaces/log.mojo). It provides a |MojoLogger| | 6 // Mojo logging service (see ../interfaces/log.mojo). It provides a |MojoLogger| |
7 // implementation which can be used as the default environment logger. | 7 // implementation which can be used as the default environment logger. |
8 // | 8 // |
9 // Example application that uses this log client to talk to the log service: | 9 // Example application that uses this log client to talk to the log service: |
10 // | 10 // |
11 // class MyDelegate : public mojo::ApplicationDelegate { | 11 // class MyDelegate : public mojo::ApplicationDelegate { |
12 // public: | 12 // public: |
13 // void Initialize(mojo::ApplicationImpl* app) override { | 13 // void Initialize(mojo::ApplicationImpl* app) override { |
14 // LogPtr log; | 14 // LogPtr log; |
15 // app->ConnectToService("mojo:log", &log); | 15 // app->ConnectToService("mojo:log", &log); |
16 // mojo::log::InitializeLogger(std::move(log), | 16 // mojo::log::InitializeLogger(std::move(log), |
17 // ApplicationRunner::GetDefaultLogger()); | 17 // mojo::Environment::GetDefaultLogger()); |
18 // mojo::ApplicationRunner::SetDefaultLogger(mojo::log::GetLogger()); | 18 // mojo::Environment::SetDefaultLogger(mojo::log::GetLogger()); |
19 // } | 19 // } |
20 // | 20 // |
21 // void Quit() { | 21 // void Quit() { |
22 // mojo::log::DestroyLogger(); | 22 // mojo::log::DestroyLogger(); |
23 // } | 23 // } |
24 // }; | 24 // }; |
25 // | 25 // |
26 // MojoResult MojoMain(MojoHandle app_request) { | 26 // MojoResult MojoMain(MojoHandle app_request) { |
27 // mojo::ApplicationRunner runner(new MyDelegate); | 27 // mojo::ApplicationRunner runner(new MyDelegate); |
28 // return runner.Run(app_request); | 28 // return runner.Run(app_request); |
(...skipping 18 matching lines...) Expand all Loading... |
47 // Must be called after |InitializeLogger()| and before |DestroyLogger()|. The | 47 // Must be called after |InitializeLogger()| and before |DestroyLogger()|. The |
48 // returned MojoLogger is thread-safe. | 48 // returned MojoLogger is thread-safe. |
49 const MojoLogger* GetLogger(); | 49 const MojoLogger* GetLogger(); |
50 | 50 |
51 void DestroyLogger(); | 51 void DestroyLogger(); |
52 | 52 |
53 } // namespace log | 53 } // namespace log |
54 } // namespace mojo | 54 } // namespace mojo |
55 | 55 |
56 #endif // MOJO_SERVICES_LOG_CPP_LOG_CLIENT_H_ | 56 #endif // MOJO_SERVICES_LOG_CPP_LOG_CLIENT_H_ |
OLD | NEW |