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.
5 #ifndef CHROMEOS_DEVICE_EVENT_LOG_IMPL_H_
6 #define CHROMEOS_DEVICE_EVENT_LOG_IMPL_H_
11 #include "base/time/time.h"
12 #include "chromeos/chromeos_export.h"
13 #include "chromeos/device_event_log.h"
17 namespace device_event_log
{
19 class CHROMEOS_EXPORT DeviceEventLogImpl
{
22 LogEntry(const char* filedesc
,
26 const std::string
& event
);
37 explicit DeviceEventLogImpl(size_t max_entries
);
38 ~DeviceEventLogImpl();
40 // Implements device_event_log::AddEntry.
41 void AddEntry(const char* file
,
45 const std::string
& event
);
47 // Implements device_event_log::GetAsString.
48 std::string
GetAsString(StringOrder order
,
49 const std::string
& format
,
54 // Called from device_event_log::AddEntry if the global instance has not been
55 // created (or has already been destroyed). Logs to LOG(ERROR) or VLOG(1).
56 static void SendToVLogOrErrorLog(const char* file
,
60 const std::string
& event
);
63 friend class DeviceEventLogTest
;
65 typedef std::list
<LogEntry
> LogEntryList
;
67 void AddLogEntry(const LogEntry
& entry
);
70 size_t max_entries() const { return max_entries_
; }
71 void set_max_entries_for_test(size_t entries
) { max_entries_
= entries
; }
74 LogEntryList entries_
;
76 DISALLOW_COPY_AND_ASSIGN(DeviceEventLogImpl
);
79 } // namespace device_event_log
81 } // namespace chromeos
83 #endif // CHROMEOS_DEVICE_EVENT_LOG_IMPL_H_