| Index: chromeos/network/network_event_log.h
|
| diff --git a/chromeos/network/network_event_log.h b/chromeos/network/network_event_log.h
|
| index 2bdb45114f0bf523295910829ae6243cde7a585d..104da008bd9e94b3cffb02682244b6482fd5b20e 100644
|
| --- a/chromeos/network/network_event_log.h
|
| +++ b/chromeos/network/network_event_log.h
|
| @@ -12,6 +12,7 @@
|
| #include "base/strings/stringprintf.h"
|
| #include "base/time/time.h"
|
| #include "chromeos/chromeos_export.h"
|
| +#include "chromeos/device_event_log.h"
|
|
|
| namespace base {
|
| class Value;
|
| @@ -22,41 +23,8 @@ namespace chromeos {
|
| // Namespace for functions for logging network events.
|
| namespace network_event_log {
|
|
|
| -// Used to determine which order to output event entries in GetAsString.
|
| -enum StringOrder {
|
| - OLDEST_FIRST,
|
| - NEWEST_FIRST
|
| -};
|
| -
|
| -// Used to set the detail level for logging.
|
| -enum LogLevel {
|
| - LOG_LEVEL_ERROR = 0,
|
| - LOG_LEVEL_USER = 1,
|
| - LOG_LEVEL_EVENT = 2,
|
| - LOG_LEVEL_DEBUG = 3
|
| -};
|
| -
|
| -// Default log level.
|
| -CHROMEOS_EXPORT extern const LogLevel kDefaultLogLevel;
|
| -
|
| -// Initializes / shuts down network event logging. Calling Initialize more than
|
| -// once will reset the log.
|
| -CHROMEOS_EXPORT void Initialize();
|
| -CHROMEOS_EXPORT void Shutdown();
|
| -
|
| -// Returns true if network event logging has been initialized.
|
| -CHROMEOS_EXPORT bool IsInitialized();
|
| -
|
| namespace internal {
|
|
|
| -// Gets the maximum number of log entries.
|
| -CHROMEOS_EXPORT size_t GetMaxLogEntries();
|
| -
|
| -// Sets the maximum number of entries to something other than the default. If
|
| -// |max_entries| is less than the current maximum number of entries, this will
|
| -// delete any existing entries in excess of |max_entries|.
|
| -CHROMEOS_EXPORT void SetMaxLogEntries(size_t max_entries);
|
| -
|
| // Adds an entry to the event log at level specified by |log_level|.
|
| // A maximum number of events are recorded after which new events replace
|
| // old ones. Error events are prioritized such that error events will only be
|
| @@ -65,55 +33,37 @@ CHROMEOS_EXPORT void SetMaxLogEntries(size_t max_entries);
|
| // has been called. NOTE: Generally use NET_LOG instead.
|
| CHROMEOS_EXPORT void AddEntry(const char* file,
|
| int file_line,
|
| - LogLevel log_level,
|
| + device_event_log::LogLevel log_level,
|
| const std::string& event,
|
| const std::string& description);
|
|
|
| } // namespace internal
|
|
|
| -// Outputs the log to a formatted string.
|
| -// |order| determines which order to output the events.
|
| -// |format| is a string that determines which elements to show. Elements
|
| -// must be comma-separated, e.g. "time,desc".
|
| -// Note: order of the format strings does not affect the output.
|
| -// "time" - Include a timestamp.
|
| -// "file" - Include file and line number.
|
| -// "desc" - Include the description.
|
| -// "html" - Include html tags.
|
| -// "json" - Return as JSON format
|
| -// Only events with |log_level| <= |max_level| are included in the output.
|
| -// If |max_events| > 0, limits how many events are output.
|
| -// If |json| is specified, returns a JSON list of dictionaries containing time,
|
| -// level, file, event, and description.
|
| -CHROMEOS_EXPORT std::string GetAsString(StringOrder order,
|
| - const std::string& format,
|
| - LogLevel max_level,
|
| - size_t max_events);
|
| -
|
| // Helper function for displaying a value as a string.
|
| CHROMEOS_EXPORT std::string ValueAsString(const base::Value& value);
|
|
|
| // Errors
|
| -#define NET_LOG_ERROR(event, desc) NET_LOG_LEVEL( \
|
| - ::chromeos::network_event_log::LOG_LEVEL_ERROR, event, desc)
|
| +#define NET_LOG_ERROR(event, desc) \
|
| + NET_LOG_LEVEL(::chromeos::device_event_log::LOG_LEVEL_ERROR, event, desc)
|
|
|
| // Chrome initiated events, e.g. connection requests, scan requests,
|
| // configuration removal (either from the UI or from ONC policy application).
|
| -#define NET_LOG_USER(event, desc) NET_LOG_LEVEL( \
|
| - ::chromeos::network_event_log::LOG_LEVEL_USER, event, desc)
|
| +#define NET_LOG_USER(event, desc) \
|
| + NET_LOG_LEVEL(::chromeos::device_event_log::LOG_LEVEL_USER, event, desc)
|
|
|
| // Important events, e.g. state updates
|
| -#define NET_LOG_EVENT(event, desc) NET_LOG_LEVEL( \
|
| - ::chromeos::network_event_log::LOG_LEVEL_EVENT, event, desc)
|
| +#define NET_LOG_EVENT(event, desc) \
|
| + NET_LOG_LEVEL(::chromeos::device_event_log::LOG_LEVEL_EVENT, event, desc)
|
|
|
| // Non-essential debugging events
|
| -#define NET_LOG_DEBUG(event, desc) NET_LOG_LEVEL( \
|
| - ::chromeos::network_event_log::LOG_LEVEL_DEBUG, event, desc)
|
| +#define NET_LOG_DEBUG(event, desc) \
|
| + NET_LOG_LEVEL(::chromeos::device_event_log::LOG_LEVEL_DEBUG, event, desc)
|
|
|
| // Macro to include file and line number info in the event log.
|
| -#define NET_LOG_LEVEL(log_level, event, description) \
|
| - ::chromeos::network_event_log::internal::AddEntry( \
|
| - __FILE__, __LINE__, log_level, event, description)
|
| +#define NET_LOG_LEVEL(log_level, event, description) \
|
| + ::chromeos::device_event_log::AddEntryWithDescription( \
|
| + __FILE__, __LINE__, ::chromeos::device_event_log::LOG_TYPE_NETWORK, \
|
| + log_level, event, description)
|
|
|
| } // namespace network_event_log
|
|
|
|
|