flutter_logan_pro 1.0.4
flutter_logan_pro: ^1.0.4 copied to clipboard
A high-performance, robust log plugin for Flutter based on Meituan Logan. Fixed truncation and decryption issues.
1.0.4 #
- Add:
getUploadPath([date])— resolves the on-disk path of the (encrypted) log file for a date so it can be attached to a bug report / shared / emailed instead of uploaded to a Logan server. Returnsnullwhen no log exists for that date. On both platforms today's file is flushed and snapshotted first; past dates return the stored file path. (iOS:loganUploadFilePath; Android:Logan.s(dates, SendLogRunnable)with an existence pre-check.) - Add:
init(minSDCardBytes:)— Android-only free-storage floor. When free space drops below this many bytes, Logan stops writing new logs (native default 50MB). Ignored on iOS, whose floor is hardcoded at 5MB. Documented in the README. - Fix (Android):
maxFileLenwas passed straight toLoganConfig.Builder.setMaxFile(), which multiplies its argument by 1MB internally — so a byte value like10*1024*1024became a ~10TB cap, effectively disabling the per-file size limit.maxFileLen(bytes) is now converted to MB, matching the documented contract and iOS behavior. Also read as aNumberso byte values above 2^31 aren't dropped. - Fix: pre-init log queue is now bounded (max 2000 entries). A long-delayed
init()(e.g. waiting on runtime permissions) can no longer let the buffer grow without limit; the oldest entries are dropped with a one-off warning. - Fix: logs queued before
init()now carry their original timestamp (prefixed to the message), instead of all collapsing onto the init moment when replayed. - Fix: iOS
send/sendWithHeadersnow coerceappId/unionId/deviceIddefensively so a strayNSNullcan't crash the native upload. - Improve: iOS
sendWithHeadersnow logs a warning when non-empty custom headers are passed (they're unsupported by the native iOS upload API and silently ignored), so an auth-token-dependent upload isn't a silent surprise. - Improve: Android
setMaxReversedDatenow warns viaandroid.util.Log(wasprintln) and explains that retention must be set throughinit(maxReversedDate:). - Security: removed plain-HTTP Aliyun Maven mirrors (
allowInsecureProtocol) from the Android build; only HTTPS mirrors remain, avoiding a cleartext supply-chain/MITM risk. - Tests: replaced the stale
getPlatformVersionAndroid unit test (wrong package, removed method) with tests fornotImplementedand theinvalid_urlguard. - Docs: added a Chinese README (
README-zh.md) and clarifiedgetAllFilesInfounits and platform differences.
1.0.3 #
- Fix: concurrent
init()calls no longer return early against a half-initialized logger (which could silently lose queued logs). - Fix: stale send callbacks (e.g. arriving after a timeout) can no longer complete a newer
send()— each request now carries a unique id matched in the handler. - Docs: clarified that iOS's
sendWithHeadersignores custom headers (the native iOS upload API has no header support) and uploads without them; Android honors them. - Fix: iOS unchecked
NSHTTPURLResponsecast and self-retaining upload block. - Fix: iOS
logno longer risks a crash on a non-NSNumbertype(e.g.NSNull); falls back to type1. - Fix: corrected
EXCLUDED_ARCHStypo (i3386→i386) in the podspec. - Fix: validate that
secretKey/secretIVare exactly 16 bytes (Dart + iOS), preventing undecryptable logs from a misconfigured key. - Fix:
LoganSendResult.isSuccess()no longer requires the server body'scode == 200; it now treats HTTP 200 as success and, when a bodycodeis present, accepts the conventional Logan success codes (0or200). The previous check could never pass against backends returningcode: 0. - Fix: Android
clearAllLogsnow flushes and clears Logan's dedicatedlogan_cachesubdirectory (where the mmap buffer lives) plus the persisted log dir — instead of wiping every file in the shared temporary directory. - Fix: date formatting/forwarding so an omitted
senddate is resolved by the native clock (matches the log file's date); Android date now usesLocale.USto avoid non-Latin digits. - Add:
getTodaysDate()andsetMaxReversedDate()to the Dart API (previously documented but missing). - Chore: removed dead
getPlatformVersionplumbing from the public class; synced podspec/pubspec versions.
1.0.2 #
- Fix: send method blocking issue on iOS.
- Fix: Parameter type mismatch in iOS native code.
- Add: Timeout mechanism for log sending (default 10s).
- Add: Better parameter validation in native plugins.
1.0.1 #
- Internal improvements and bug fixes.
- Updated documentation.
1.0.0 #
- Initial release of
flutter_logan_pro. - High-performance, encrypted logging for Flutter on both iOS and Android.
- Core features:
init: Initialize the logger with encryption keys.log: Write log messages. Supports pre-initialization queueing.send/sendWithHeaders: Upload logs to a server and await a structuredLoganSendResult.flush: Manually flush logs to disk.clearAllLogs: Delete all generated log files.getAllFilesInfo: Get metadata for all local log files.setMaxReversedDate: Configure log file retention policy.setDebug: Enable verbose logging from the underlying native libraries.