Agora Java API Reference for Android
IAgoraLog.h
1 //
2 // Agora Media SDK
3 //
4 // Copyright (c) 2015 Agora IO. All rights reserved.
5 //
6 #pragma once
7 
8 #include <cstdlib>
9 #include <cstdint>
10 
11 namespace agora {
12 namespace commons {
13 
17 enum class LOG_LEVEL {
18  LOG_LEVEL_NONE = 0x0000,
19  LOG_LEVEL_INFO = 0x0001,
20  LOG_LEVEL_WARN = 0x0002,
21  LOG_LEVEL_ERROR = 0x0004,
22  LOG_LEVEL_FATAL = 0x0008,
23 };
24 
25 /*
26 The SDK uses ILogWriter class Write interface to write logs as application
27 The application inherits the methods Write() to implentation their own log writ
28 
29 Write has default implementation, it writes logs to files.
30 Application can use setLogFile() to change file location, see description of set
31 */
32 class ILogWriter {
33  public:
42  virtual int32_t writeLog(LOG_LEVEL level, const char* message, uint16_t length) = 0;
43 
44  virtual ~ILogWriter() {}
45 };
46 
47 enum LOG_FILTER_TYPE {
48  LOG_FILTER_OFF = 0,
49  LOG_FILTER_DEBUG = 0x080f,
50  LOG_FILTER_INFO = 0x000f,
51  LOG_FILTER_WARN = 0x000e,
52  LOG_FILTER_ERROR = 0x000c,
53  LOG_FILTER_CRITICAL = 0x0008,
54  LOG_FILTER_MASK = 0x80f,
55 };
56 
57 const uint32_t MAX_LOG_SIZE = 20 * 1024 * 1024; // 20MB
58 const uint32_t MIN_LOG_SIZE = 128 * 1024; // 128KB
61 const uint32_t DEFAULT_LOG_SIZE_IN_KB = 1024;
62 
65 struct LogConfig
66 {
69  const char* filePath;
72  uint32_t fileSizeInKB;
75  LOG_LEVEL level;
76 
77  LogConfig() : filePath(NULL), fileSizeInKB(DEFAULT_LOG_SIZE_IN_KB), level(LOG_LEVEL::LOG_LEVEL_INFO) {}
78 };
79 } //namespace commons
80 } //namespace agora
agora::commons::ILogWriter
Definition: IAgoraLog.h:32
agora::commons::LogConfig::filePath
const char * filePath
Definition: IAgoraLog.h:69
agora::commons::LogConfig::fileSizeInKB
uint32_t fileSizeInKB
Definition: IAgoraLog.h:72
agora::commons::ILogWriter::writeLog
virtual int32_t writeLog(LOG_LEVEL level, const char *message, uint16_t length)=0
agora::commons::LogConfig
Definition: IAgoraLog.h:66
agora::commons::LogConfig::level
LOG_LEVEL level
Definition: IAgoraLog.h:75