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

Issue 1447273002: Mojo Log service and a thread-safe client library. (Closed)

Created:
5 years, 1 month ago by vardhan
Modified:
5 years ago
Reviewers:
jamesr, viettrungluu
CC:
Aaron Boodman, abarth-chromium, ben+mojo_chromium.org, darin (slow to review), gregsimon, mojo-reviews_chromium.org, qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, yzshen+mojopublicwatch_chromium.org
Base URL:
https://github.com/domokit/mojo.git@master
Target Ref:
refs/heads/master
Project:
mojo
Visibility:
Public.

Description

Mojo Log service and a thread-safe client library. The service impl itself is pretty thin and does what we currently already do: print messages to stderr. The log client provides a MojoLogger (you can hook this up to mojo::Environment and have MOJO_LOG() go directly to the Log service), and is thread-safe. Other small changes to acommodate this CL: - mojo::Environment now has SetDefaultLogger() for replacing the logger. - Move mojo::internal::MessageBuilder out of internal namespace. R=viettrungluu@chromium.org Committed: https://chromium.googlesource.com/external/mojo/+/bb3649854a7d7a5ec4c0c42055108b4d174cb151

Patch Set 1 #

Patch Set 2 : oops: restore vtl's TODO, fix LogClient::GetLogger() #

Total comments: 2

Patch Set 3 : Fix destructor race condition in log_client.cc; add some comments #

Total comments: 3

Patch Set 4 : removed environment & bindings changes from previous patchset. remove unused mojo::log::EntryMetad… #

Total comments: 45

Patch Set 5 : add a log service unittest. formatting. update log_client.h example/usage comments. #

Patch Set 6 : try using fmemopen() instead of open_memstream (android try bots can't seem to find it) #

Patch Set 7 : use pipe() instead of fmemopen() to mock a FILE that LogImpl can use #

Total comments: 2

Patch Set 8 : in log_impl.cc: MOJO_DCHECK -> DCHECK. for log service impl: use //mojo/application instead of SDK'… #

Patch Set 9 : oops, forgot to #include "base/macros.h" in log_impl.h #

Total comments: 6

Patch Set 10 : hide LogClient class and expose InitializeLogger()/GetLogger/DestroyLogger() global functions inste… #

Total comments: 2

Patch Set 11 : fix race condition in unittest (by adding a 10ms wait) #

Total comments: 28

Patch Set 12 : make min log level consistent with fallback logger, fix thread-safety, address trung's other commen… #

Total comments: 14

Patch Set 13 : relax MojoLogger.SetMinimumLogLevel thread-safety & related comments. #

Total comments: 4

Patch Set 14 : initialize global variables at start of the test #

Unified diffs Side-by-side diffs Delta from patch set Stats (+753 lines, -39 lines) Patch
M PRESUBMIT.py View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M mojo/BUILD.gn View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -0 lines 0 comments Download
A + mojo/services/log/cpp/BUILD.gn View 2 chunks +13 lines, -20 lines 0 comments Download
A mojo/services/log/cpp/lib/log_client.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +170 lines, -0 lines 0 comments Download
A mojo/services/log/cpp/log_client.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +56 lines, -0 lines 0 comments Download
A mojo/services/log/cpp/tests/log_client_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +122 lines, -0 lines 0 comments Download
A + mojo/services/log/interfaces/BUILD.gn View 1 chunk +2 lines, -5 lines 0 comments Download
A mojo/services/log/interfaces/entry.mojom View 1 2 3 4 1 chunk +34 lines, -0 lines 0 comments Download
A mojo/services/log/interfaces/log.mojom View 1 2 3 4 1 chunk +13 lines, -0 lines 0 comments Download
M mojo/services/mojo_services.gni View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M mojo/tools/data/apptests View 1 2 3 4 5 6 7 8 9 1 chunk +6 lines, -0 lines 0 comments Download
M services/BUILD.gn View 1 2 3 4 5 6 7 8 9 2 chunks +2 lines, -0 lines 0 comments Download
A services/log/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +51 lines, -0 lines 0 comments Download
A services/log/log_impl.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +60 lines, -0 lines 0 comments Download
A services/log/log_impl.cc View 1 2 3 4 5 6 7 1 chunk +96 lines, -0 lines 0 comments Download
A services/log/log_impl_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +106 lines, -0 lines 0 comments Download
A + services/log/main.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +19 lines, -14 lines 0 comments Download

Messages

Total messages: 22 (2 generated)
vardhan
PTAL. Please let me know if you'd like me to break up this CL if ...
5 years, 1 month ago (2015-11-16 23:57:25 UTC) #2
jamesr
https://codereview.chromium.org/1447273002/diff/20001/mojo/services/log/cpp/lib/log_client.cc File mojo/services/log/cpp/lib/log_client.cc (right): https://codereview.chromium.org/1447273002/diff/20001/mojo/services/log/cpp/lib/log_client.cc#newcode32 mojo/services/log/cpp/lib/log_client.cc:32: InterfacePtrInfo<mojo::log::Log> g_log_interface; this will introduce a static destructor, which ...
5 years, 1 month ago (2015-11-17 00:34:17 UTC) #3
viettrungluu
On 2015/11/16 23:57:25, vardhan wrote: > PTAL. > > Please let me know if you'd ...
5 years, 1 month ago (2015-11-17 22:33:09 UTC) #4
viettrungluu
gah https://codereview.chromium.org/1447273002/diff/40001/mojo/public/cpp/environment/lib/environment.cc File mojo/public/cpp/environment/lib/environment.cc (right): https://codereview.chromium.org/1447273002/diff/40001/mojo/public/cpp/environment/lib/environment.cc#newcode26 mojo/public/cpp/environment/lib/environment.cc:26: nit: Adding this blank line seems gratuitous. https://codereview.chromium.org/1447273002/diff/40001/mojo/public/cpp/environment/lib/environment.cc#newcode68 ...
5 years, 1 month ago (2015-11-17 22:33:33 UTC) #5
viettrungluu
(I haven't fully reviewed the log client code yet.) https://codereview.chromium.org/1447273002/diff/60001/mojo/services/log/cpp/lib/log_client.cc File mojo/services/log/cpp/lib/log_client.cc (right): https://codereview.chromium.org/1447273002/diff/60001/mojo/services/log/cpp/lib/log_client.cc#newcode43 mojo/services/log/cpp/lib/log_client.cc:43: ...
5 years, 1 month ago (2015-11-20 23:21:51 UTC) #6
vardhan
PTAL https://codereview.chromium.org/1447273002/diff/20001/mojo/services/log/cpp/lib/log_client.cc File mojo/services/log/cpp/lib/log_client.cc (right): https://codereview.chromium.org/1447273002/diff/20001/mojo/services/log/cpp/lib/log_client.cc#newcode32 mojo/services/log/cpp/lib/log_client.cc:32: InterfacePtrInfo<mojo::log::Log> g_log_interface; On 2015/11/17 00:34:17, jamesr wrote: > ...
5 years ago (2015-12-02 00:06:14 UTC) #7
viettrungluu
https://codereview.chromium.org/1447273002/diff/60001/services/log/log_impl.cc File services/log/log_impl.cc (right): https://codereview.chromium.org/1447273002/diff/60001/services/log/log_impl.cc#newcode47 services/log/log_impl.cc:47: MOJO_DCHECK(connection); On 2015/12/02 00:06:14, vardhan wrote: > On 2015/11/20 ...
5 years ago (2015-12-02 00:08:02 UTC) #8
viettrungluu
https://codereview.chromium.org/1447273002/diff/120001/services/log/BUILD.gn File services/log/BUILD.gn (right): https://codereview.chromium.org/1447273002/diff/120001/services/log/BUILD.gn#newcode27 services/log/BUILD.gn:27: "//mojo/public/cpp/application:standalone", If you're using //base (which you are, via ...
5 years ago (2015-12-02 01:08:49 UTC) #9
vardhan
PTAL https://codereview.chromium.org/1447273002/diff/120001/services/log/BUILD.gn File services/log/BUILD.gn (right): https://codereview.chromium.org/1447273002/diff/120001/services/log/BUILD.gn#newcode27 services/log/BUILD.gn:27: "//mojo/public/cpp/application:standalone", On 2015/12/02 01:08:49, viettrungluu wrote: > If ...
5 years ago (2015-12-02 01:47:58 UTC) #10
viettrungluu
https://codereview.chromium.org/1447273002/diff/160001/mojo/services/log/cpp/lib/log_client.cc File mojo/services/log/cpp/lib/log_client.cc (right): https://codereview.chromium.org/1447273002/diff/160001/mojo/services/log/cpp/lib/log_client.cc#newcode36 mojo/services/log/cpp/lib/log_client.cc:36: std::atomic<MojoLogLevel> g_min_log_level; Hmmm. This may lead to a static ...
5 years ago (2015-12-03 19:13:25 UTC) #11
viettrungluu
https://codereview.chromium.org/1447273002/diff/180001/services/log/log_impl.cc File services/log/log_impl.cc (right): https://codereview.chromium.org/1447273002/diff/180001/services/log/log_impl.cc#newcode45 services/log/log_impl.cc:45: FILE* out_file) Does this own out_file or not? If ...
5 years ago (2015-12-11 23:56:47 UTC) #12
vardhan
ptal https://codereview.chromium.org/1447273002/diff/160001/mojo/services/log/cpp/lib/log_client.cc File mojo/services/log/cpp/lib/log_client.cc (right): https://codereview.chromium.org/1447273002/diff/160001/mojo/services/log/cpp/lib/log_client.cc#newcode36 mojo/services/log/cpp/lib/log_client.cc:36: std::atomic<MojoLogLevel> g_min_log_level; On 2015/12/03 19:13:25, viettrungluu wrote: > ...
5 years ago (2015-12-15 01:55:06 UTC) #13
viettrungluu
https://codereview.chromium.org/1447273002/diff/200001/mojo/services/log/cpp/BUILD.gn File mojo/services/log/cpp/BUILD.gn (right): https://codereview.chromium.org/1447273002/diff/200001/mojo/services/log/cpp/BUILD.gn#newcode13 mojo/services/log/cpp/BUILD.gn:13: restrict_external_deps = false Do you actually need this, if ...
5 years ago (2015-12-15 18:33:08 UTC) #14
vardhan
PTAL https://codereview.chromium.org/1447273002/diff/200001/mojo/services/log/cpp/BUILD.gn File mojo/services/log/cpp/BUILD.gn (right): https://codereview.chromium.org/1447273002/diff/200001/mojo/services/log/cpp/BUILD.gn#newcode13 mojo/services/log/cpp/BUILD.gn:13: restrict_external_deps = false On 2015/12/15 18:33:08, viettrungluu wrote: ...
5 years ago (2015-12-16 18:29:05 UTC) #15
viettrungluu
https://codereview.chromium.org/1447273002/diff/220001/mojo/public/cpp/environment/environment.h File mojo/public/cpp/environment/environment.h (right): https://codereview.chromium.org/1447273002/diff/220001/mojo/public/cpp/environment/environment.h#newcode34 mojo/public/cpp/environment/environment.h:34: // TODO(vardhan): Require that this logger is thread-safe. It ...
5 years ago (2015-12-17 18:34:40 UTC) #16
vardhan
PTAL https://codereview.chromium.org/1447273002/diff/220001/mojo/public/cpp/environment/environment.h File mojo/public/cpp/environment/environment.h (right): https://codereview.chromium.org/1447273002/diff/220001/mojo/public/cpp/environment/environment.h#newcode34 mojo/public/cpp/environment/environment.h:34: // TODO(vardhan): Require that this logger is thread-safe. ...
5 years ago (2015-12-17 23:35:42 UTC) #17
viettrungluu
We have passed 100 comments (triple digits!), so LGTM, with one more thing. https://codereview.chromium.org/1447273002/diff/240001/mojo/services/log/cpp/tests/log_client_unittest.cc File ...
5 years ago (2015-12-18 00:32:56 UTC) #18
vardhan
PTAL at comments (submitting later tomorrow otherwise) https://codereview.chromium.org/1447273002/diff/240001/mojo/services/log/cpp/tests/log_client_unittest.cc File mojo/services/log/cpp/tests/log_client_unittest.cc (right): https://codereview.chromium.org/1447273002/diff/240001/mojo/services/log/cpp/tests/log_client_unittest.cc#newcode50 mojo/services/log/cpp/tests/log_client_unittest.cc:50: MojoLogLevel g_fallback_logger_level ...
5 years ago (2015-12-18 03:56:29 UTC) #19
viettrungluu
On 2015/12/18 03:56:29, vardhan wrote: > PTAL at comments (submitting later tomorrow otherwise) > > ...
5 years ago (2015-12-18 17:35:55 UTC) #20
vardhan
5 years ago (2015-12-18 19:09:10 UTC) #22
Message was sent while issue was closed.
Committed patchset #14 (id:260001) manually as
bb3649854a7d7a5ec4c0c42055108b4d174cb151 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698