title | nav |
---|---|
Writing HmsLogs in Local Storage |
12.1 |
Logs from hmsSDK
can be saved as a file in local storage by setting the settings from HmsLogSettings
in Builder of hmsSDK
instance.
In this , whenever there is a log printed from hmsSDK it will be saved in a seperate file.
馃挕 Each new meeting will have a seperate
session log
with file name assession-log-<room_id>
file, where<room_id>
is a placeholder
HmsLogSettings must be passed as a parameter in hmsSdk builder object during instantiation.
Params:
maxDirSizeInBytes
- max dir size in bytes to be maintained for /logs default - set to 10mb.
馃挕 Note : if the directory size exceeds the
maxDirSizeInBytes
provided by client, then it will delete the oldest files next time user starts a meeting to make room for new ones.
A background service is also started once a day to make sure that size of directory never exceeds the desired size.
isLogStorageEnabled
- set to true if /logs are to be saved else false default - false.
level
- set log level for logs to observe default - HMSLogger.Debug
<Tabs id="save-log-dir" items={['Kotlin', 'Java']} />
private val hmsLogSettings : HMSLogSettings = HMSLogSettings(LogAlarmManager.DEFAULT_DIR_SIZE,true)
val hmsSDK = HMSSDK
.Builder(application)
.setLogSettings(hmsLogSettings)
.build()
HMSLogSettings hmsLogSettings = new HMSLogSettings(LogAlarmManager.DEFAULT_DIR_SIZE,true, HMSLogger.LogLevel.DEBUG);
HMSSDK hmssdk = new HMSSDK.Builder(application)
.setTrackSettings(hmsTrackSettings)
.build();
馃挕 whenever there is a crash in
hmsSDK
, it will be logged in the file named ascrash-log-<room_id>
where<room_id>
is a placeholder.
It could look something like this:
import live.hms.video.utils.LogUtils
<Tabs id="fetch-log-dir" items={['Kotlin', 'Java']} />
val dir : File = LogUtils.getDirPath(context = context)
File dir = LogUtils.getDirPath(context)