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

Side by Side Diff: components/offline_pages/core/offline_event_logger.cc

Issue 2562913002: [Offline Pages] Minor fix for log messages in event logger. (Closed)
Patch Set: fix test. Created 4 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | components/offline_pages/core/offline_event_logger_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "base/strings/stringprintf.h" 5 #include "base/strings/stringprintf.h"
6 #include "base/time/time.h" 6 #include "base/time/time.h"
7 #include "components/offline_pages/core/offline_event_logger.h" 7 #include "components/offline_pages/core/offline_event_logger.h"
8 8
9 namespace offline_pages { 9 namespace offline_pages {
10 10
(...skipping 26 matching lines...) Expand all
37 return; 37 return;
38 38
39 base::Time::Exploded current_time; 39 base::Time::Exploded current_time;
40 base::Time::Now().LocalExplode(&current_time); 40 base::Time::Now().LocalExplode(&current_time);
41 41
42 std::string date_string = base::StringPrintf( 42 std::string date_string = base::StringPrintf(
43 "%d %02d %02d %02d:%02d:%02d", current_time.year, current_time.month, 43 "%d %02d %02d %02d:%02d:%02d", current_time.year, current_time.month,
44 current_time.day_of_month, current_time.hour, current_time.minute, 44 current_time.day_of_month, current_time.hour, current_time.minute,
45 current_time.second); 45 current_time.second);
46 46
47 std::string log_message = date_string + ": " + activity;
48 if (client_) 47 if (client_)
49 client_->CustomLog(log_message); 48 client_->CustomLog(activity);
50 49
51 if (activities_.size() == kMaxLogCount) 50 if (activities_.size() == kMaxLogCount)
52 activities_.pop_back(); 51 activities_.pop_back();
53 52
54 activities_.push_front(log_message); 53 activities_.push_front(date_string + ": " + activity);
55 } 54 }
56 55
57 void OfflineEventLogger::SetClient(Client* client) { 56 void OfflineEventLogger::SetClient(Client* client) {
58 DCHECK(client); 57 DCHECK(client);
59 SetIsLogging(true); 58 SetIsLogging(true);
60 client_ = client; 59 client_ = client;
61 } 60 }
62 61
63 } // namespace offline_pages 62 } // namespace offline_pages
OLDNEW
« no previous file with comments | « no previous file | components/offline_pages/core/offline_event_logger_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698