Save recent Widevine CDM logs
Bug: 162255728 Test: cdm unit tests Change-Id: Ibc0daf374bedd8ac2a9a0515835e2775045962a7
This commit is contained in:
@@ -7,6 +7,11 @@
|
||||
#ifndef WVCDM_UTIL_LOG_H_
|
||||
#define WVCDM_UTIL_LOG_H_
|
||||
|
||||
#include <cstdint>
|
||||
#include <deque>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "util_common.h"
|
||||
|
||||
namespace wvcdm {
|
||||
@@ -27,6 +32,24 @@ typedef enum {
|
||||
|
||||
extern LogPriority g_cutoff;
|
||||
|
||||
struct LogMessage {
|
||||
int64_t time_ms_;
|
||||
LogPriority priority_;
|
||||
std::string message_;
|
||||
};
|
||||
|
||||
class LogBuffer {
|
||||
public:
|
||||
static const int MAX_CAPACITY = 100;
|
||||
void addLog(const LogMessage& log);
|
||||
std::vector<LogMessage> getLogs();
|
||||
private:
|
||||
std::deque<LogMessage> buffer_;
|
||||
std::mutex mutex_;
|
||||
};
|
||||
|
||||
extern LogBuffer g_logbuf;
|
||||
|
||||
// Enable/disable verbose logging (LOGV).
|
||||
// This function is supplied for cases where the system layer does not
|
||||
// initialize logging. This is also needed to initialize logging in
|
||||
|
||||
Reference in New Issue
Block a user