io.agora.rtm.RtmLogConfig Maven / Gradle / Ivy
package io.agora.rtm;
import io.agora.common.internal.CalledByNative;
import io.agora.rtm.RtmConstants.RtmLogLevel;
/**
* rtm log configuration
*/
public class RtmLogConfig {
/**
* The log file set by user, null for default log path.
*/
private String filePath = "";
/**
* The log file size set by user, 1024KB will be set for default log size
* if this value is less than or equal to 0.
*/
private int fileSizeInKB;
/**
* The log level set by user, INFO is default level.
* You can use one of the level defined in RtmLogLevel.
* {@link RtmConstants.RtmLogLevel}.
*/
private RtmLogLevel level = RtmLogLevel.INFO;
/**
* Creates a new instance of {@code RtmLogConfig} with default parameters.
*/
public RtmLogConfig() {
this.fileSizeInKB = 1024;
}
/**
* Creates a new instance of {@code RtmLogConfig} with specifies parameters.
*
* @param filePath The log file path
* @param fileSize The log file size, the default unit for log file size is KB
* @param level The log level
*/
public RtmLogConfig(String filePath, int fileSize, RtmLogLevel level) {
this.filePath = filePath;
this.fileSizeInKB = fileSize;
this.level = level;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
public void setFileSize(int fileSize) {
this.fileSizeInKB = fileSize;
}
public void setLevel(RtmLogLevel level) {
this.level = level;
}
@CalledByNative
public String getFilePath() {
return filePath;
}
@CalledByNative
public int getFileSize() {
return fileSizeInKB;
}
@CalledByNative
public int getLevel() {
return RtmLogLevel.getValue(this.level);
}
@Override
public String toString() {
return "RtmLogConfig {filePath: " + filePath + ", fileSizeInKB: " + fileSizeInKB
+ ", level: " + level + "}";
}
}