OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/chromeos/system_logs/device_event_log_source.h" |
| 6 |
| 7 #include "base/message_loop/message_loop.h" |
| 8 #include "chromeos/device_event_log.h" |
| 9 #include "content/public/browser/browser_thread.h" |
| 10 |
| 11 namespace system_logs { |
| 12 |
| 13 const char kNetworkEventLogEntry[] = "network_event_log"; |
| 14 const char kDeviceEventLogEntry[] = "device_event_log"; |
| 15 |
| 16 DeviceEventLogSource::DeviceEventLogSource() : SystemLogsSource("DeviceEvent") { |
| 17 } |
| 18 |
| 19 DeviceEventLogSource::~DeviceEventLogSource() { |
| 20 } |
| 21 |
| 22 void DeviceEventLogSource::Fetch(const SysLogsSourceCallback& callback) { |
| 23 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 24 DCHECK(!callback.is_null()); |
| 25 |
| 26 scoped_ptr<SystemLogsResponse> response(new SystemLogsResponse); |
| 27 const int kMaxDeviceEventsForAboutSystem = 400; |
| 28 (*response)[kNetworkEventLogEntry] = chromeos::device_event_log::GetAsString( |
| 29 chromeos::device_event_log::OLDEST_FIRST, "time,file,level", |
| 30 chromeos::device_event_log::LOG_TYPE_NETWORK, |
| 31 chromeos::device_event_log::kDefaultLogLevel, |
| 32 kMaxDeviceEventsForAboutSystem); |
| 33 (*response)[kDeviceEventLogEntry] = chromeos::device_event_log::GetAsString( |
| 34 chromeos::device_event_log::OLDEST_FIRST, "time,file,type,level", |
| 35 chromeos::device_event_log::LOG_TYPE_NON_NETWORK, |
| 36 chromeos::device_event_log::LOG_LEVEL_DEBUG, |
| 37 kMaxDeviceEventsForAboutSystem); |
| 38 callback.Run(response.get()); |
| 39 } |
| 40 |
| 41 } // namespace system_logs |
OLD | NEW |