| OLD | NEW |
| 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 Loading... |
| 37 return; | 37 return; |
| 38 | 38 |
| 39 base::Time::Exploded current_time; | 39 base::Time::Exploded current_time; |
| 40 base::Time::Now().LocalExplode(¤t_time); | 40 base::Time::Now().LocalExplode(¤t_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 |
| OLD | NEW |