Mirror syncfs log to console and WebUI, with LogSeverity support.
Please note that this supports INFO, WARNING, ERROR. I have yet to add support for DVLOG levels.
BUG=241689
TEST=chrome/browser/sync_file_system/logger_unittest.cc
unit_tests.LoggerTest*
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=202424
Hi Hiroki, can you please take an initial look at this to see if this ...
7 years, 7 months ago
(2013-05-22 04:53:06 UTC)
#1
Hi Hiroki, can you please take an initial look at this to see if this feature
addition would be useful?
It's manually testable using:
out/Debug/chrome --enable-logging --log-level=0
out/Debug/chrome --enable-logging --log-level=1
go to URL chrome://syncfs-internals to check the output.
log-level=0 to get INFO messages and above, 1 for warnings and above. With level
0, you should see all output but with level 1, you should only see the warns and
errors.
If this looks ok to you, I'll add some tests for this before going for a final
review to get a LGTM
nhiroki
Looks good to me https://codereview.chromium.org/15657002/diff/1/chrome/browser/sync_file_system/drive/api_util.cc File chrome/browser/sync_file_system/drive/api_util.cc (right): https://codereview.chromium.org/15657002/diff/1/chrome/browser/sync_file_system/drive/api_util.cc#newcode311 chrome/browser/sync_file_system/drive/api_util.cc:311: util::Log(logging::LOG_ERROR, nit: Can you align ...
7 years, 7 months ago
(2013-05-22 05:42:40 UTC)
#2
https://codereview.chromium.org/15657002/diff/15001/chrome/browser/sync_file_system/logger.cc File chrome/browser/sync_file_system/logger.cc (right): https://codereview.chromium.org/15657002/diff/15001/chrome/browser/sync_file_system/logger.cc#newcode52 chrome/browser/sync_file_system/logger.cc:52: // Static nit: I think you don't have to ...
7 years, 7 months ago
(2013-05-22 09:18:24 UTC)
#4
https://codereview.chromium.org/15657002/diff/40001/chrome/browser/sync_file_system/logger.cc File chrome/browser/sync_file_system/logger.cc (right): https://codereview.chromium.org/15657002/diff/40001/chrome/browser/sync_file_system/logger.cc#newcode73 chrome/browser/sync_file_system/logger.cc:73: base::FilePath path(FILE_PATH_LITERAL(location.file_name())); FILE_PATH_LITERAL is only for a literal. This ...
7 years, 7 months ago
(2013-05-24 04:08:32 UTC)
#8
7 years, 7 months ago
(2013-05-24 05:12:43 UTC)
#9
https://codereview.chromium.org/15657002/diff/40001/chrome/browser/sync_file_...
File chrome/browser/sync_file_system/logger.cc (right):
https://codereview.chromium.org/15657002/diff/40001/chrome/browser/sync_file_...
chrome/browser/sync_file_system/logger.cc:73: base::FilePath
path(FILE_PATH_LITERAL(location.file_name()));
On 2013/05/24 04:08:32, tzik wrote:
> FILE_PATH_LITERAL is only for a literal. This will hit a compile error on
> windows.
Thanks for Hiroki for pointing out that I can probably use
base::FilePath::FromUTF8Unsafe(location.file_name());
https://codereview.chromium.org/15657002/diff/40001/chrome/browser/sync_file_...
chrome/browser/sync_file_system/logger.cc:88: LogToConsole(severity,
log_output);
On 2013/05/24 04:08:32, tzik wrote:
> Can we use RowLog instead? And then can we drop LogToConsole?
I tried this originally but I couldn't figure out a good way to map from
logging::LogSeverity severity back to the macros INFO, WARNING, ERROR. i.e. how
to do
RAW_LOG(severity, message) without the switch from LogToConsole();
I could move the LOG(severity) statement back into the macro but then I'd have
to keep the StringPrintf in the macro too.
Is there a third solution?
https://codereview.chromium.org/15657002/diff/40001/chrome/browser/sync_file_...
File chrome/browser/sync_file_system/logger.h (right):
https://codereview.chromium.org/15657002/diff/40001/chrome/browser/sync_file_...
chrome/browser/sync_file_system/logger.h:42: (__VA_ARGS__)
On 2013/05/24 04:08:32, tzik wrote:
> Could you avoid using macros in other than simplest case?
> This looks too complicated for me to accept...
>
> If this is needed, we should use Log directly.
Ok, I did a little bit more research on MARCROs and I think I figured out the
magic syntax to make this work with just a single macro now.
tzik
https://codereview.chromium.org/15657002/diff/40001/chrome/browser/sync_file_system/logger.cc File chrome/browser/sync_file_system/logger.cc (right): https://codereview.chromium.org/15657002/diff/40001/chrome/browser/sync_file_system/logger.cc#newcode88 chrome/browser/sync_file_system/logger.cc:88: LogToConsole(severity, log_output); On 2013/05/24 05:12:43, calvinlo wrote: > On ...
7 years, 7 months ago
(2013-05-24 11:17:38 UTC)
#10
https://codereview.chromium.org/15657002/diff/40001/chrome/browser/sync_file_...
File chrome/browser/sync_file_system/logger.cc (right):
https://codereview.chromium.org/15657002/diff/40001/chrome/browser/sync_file_...
chrome/browser/sync_file_system/logger.cc:88: LogToConsole(severity,
log_output);
On 2013/05/24 05:12:43, calvinlo wrote:
> On 2013/05/24 04:08:32, tzik wrote:
> > Can we use RowLog instead? And then can we drop LogToConsole?
>
> I tried this originally but I couldn't figure out a good way to map from
> logging::LogSeverity severity back to the macros INFO, WARNING, ERROR. i.e.
how
> to do
> RAW_LOG(severity, message) without the switch from LogToConsole();
>
> I could move the LOG(severity) statement back into the macro but then I'd have
> to keep the StringPrintf in the macro too.
>
> Is there a third solution?
Just like below seems to work:
logging::RawLog(severity, log_output.c_str());
https://codereview.chromium.org/15657002/diff/55001/chrome/browser/sync_file_...
File chrome/browser/sync_file_system/logger.h (right):
https://codereview.chromium.org/15657002/diff/55001/chrome/browser/sync_file_...
chrome/browser/sync_file_system/logger.h:34: FROM_HERE, logging::LOG_##severity,
format, ##__VA_ARGS__);
This is a shorthand of
util::Log(FROM_HERE, logging::LOG_WARNING,
"abc%s", "ba");
with
SYNCFS_LOG(WARNING, "abc%s", "ba")
But, this seem not worth defining new macro in .h as our coding style warns:
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Prepro...
Yes, once I suggested you to use macro to insert FROM_HERE, though let me change
my recommendation:
Could we directly write down FROM_HERE and logging::LOG_ for each call site?
calvinlo
https://codereview.chromium.org/15657002/diff/55001/chrome/browser/sync_file_system/logger.h File chrome/browser/sync_file_system/logger.h (right): https://codereview.chromium.org/15657002/diff/55001/chrome/browser/sync_file_system/logger.h#newcode34 chrome/browser/sync_file_system/logger.h:34: FROM_HERE, logging::LOG_##severity, format, ##__VA_ARGS__); On 2013/05/24 11:17:38, tzik wrote: ...
7 years, 7 months ago
(2013-05-25 06:03:25 UTC)
#11
https://codereview.chromium.org/15657002/diff/55001/chrome/browser/sync_file_...
File chrome/browser/sync_file_system/logger.h (right):
https://codereview.chromium.org/15657002/diff/55001/chrome/browser/sync_file_...
chrome/browser/sync_file_system/logger.h:34: FROM_HERE, logging::LOG_##severity,
format, ##__VA_ARGS__);
On 2013/05/24 11:17:38, tzik wrote:
> This is a shorthand of
> util::Log(FROM_HERE, logging::LOG_WARNING,
> "abc%s", "ba");
> with
> SYNCFS_LOG(WARNING, "abc%s", "ba")
>
> But, this seem not worth defining new macro in .h as our coding style warns:
>
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Prepro...
>
> Yes, once I suggested you to use macro to insert FROM_HERE, though let me
change
> my recommendation:
> Could we directly write down FROM_HERE and logging::LOG_ for each call site?
Ah yes, after reading the Style guide reference you linked I agree that using
this Macro is a great idea here. I will change all the call sites to be regular
function calls.
kinuko
I've written a few high-level comments on the issue. I continue to defer this review ...
7 years, 7 months ago
(2013-05-27 02:30:46 UTC)
#12
Sorry for I got bad news for ya. Compile failed with a clobber build on ...
7 years, 7 months ago
(2013-05-27 10:00:29 UTC)
#17
Sorry for I got bad news for ya.
Compile failed with a clobber build on android_clang_dbg.
http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=android_cl...
Your code is likely broken or HEAD is junk. Please ensure your
code is not broken then alert the build sheriffs.
Look at the try server FAQ for more details.
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/calvinlo@chromium.org/15657002/84005
7 years, 7 months ago
(2013-05-27 10:41:17 UTC)
#18
https://codereview.chromium.org/15657002/diff/84005/chrome/browser/sync_file_system/logger_unittest.cc File chrome/browser/sync_file_system/logger_unittest.cc (right): https://codereview.chromium.org/15657002/diff/84005/chrome/browser/sync_file_system/logger_unittest.cc#newcode46 chrome/browser/sync_file_system/logger_unittest.cc:46: EXPECT_EQ(3u, log.size()); The three EXPECT_TRUE below do not cause ...
7 years, 7 months ago
(2013-05-27 10:55:44 UTC)
#19
Issue 15657002: Mirror syncfs log to console and WebUI, with LogSeverity support.
(Closed)
Created 7 years, 7 months ago by calvinlo
Modified 7 years, 7 months ago
Reviewers: nhiroki, tzik, commit-bot: I haz the power
Base URL: svn://svn.chromium.org/chrome/trunk/src
Comments: 49