Skip to content
This repository was archived by the owner on Dec 29, 2025. It is now read-only.

Commit 92fbca2

Browse files
authored
Create CacheLogger.java
1 parent 015e46a commit 92fbca2

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package id.my.alvinq.prokitid.libs;
2+
3+
import android.content.Context;
4+
import org.levimc.launcher.util.Logger;
5+
6+
import java.io.File;
7+
8+
public class CacheLogger {
9+
10+
//private static final String TAG = "CacheLogger";
11+
12+
public static void logAllCacheFiles(Context context) {
13+
if (context == null) {
14+
Logger.get().info(TAG, "Context is null, cannot get cache directory!");
15+
return;
16+
}
17+
18+
File cacheDir = context.getCacheDir();
19+
if (cacheDir != null && cacheDir.exists()) {
20+
Logger.get().info(TAG, "Cache directory: " + cacheDir.getAbsolutePath());
21+
22+
File[] files = cacheDir.listFiles();
23+
if (files != null && files.length > 0) {
24+
for (File file : files) {
25+
if (file.isDirectory()) {
26+
Logger.get().info(TAG, "DIR : " + file.getAbsolutePath());
27+
} else {
28+
Logger.get().info(TAG, "FILE: " + file.getAbsolutePath() + " (" + file.length() + " bytes)");
29+
}
30+
}
31+
} else {
32+
Logger.get().info(TAG, "Cache directory is empty.");
33+
}
34+
} else {
35+
Logger.get().info(TAG, "Cache directory does not exist.");
36+
}
37+
}
38+
}

0 commit comments

Comments
 (0)