Add timestamps to lightning.log entries (#3771)
What changed, and why it matters
This change only adds UTC timestamps to lines written to a user-exported lightning.log file. It is a straightforward logging improvement with no security relevance.
No security action needed; treat as routine logging enhancement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies two call sites in cw_bitcoin/lib/lightning/lightning_wallet.dart that append to lightning.log. Previously each line was formatted as ‘[level] message’ or ‘[ERROR] error’; now each line is prefixed with DateTime.now().toUtc().toIso8601String(). No file paths, permissions, input handling, or control flow changed.
Changed components
cw_bitcoin/lib/lightning/lightning_wallet.dartInspect captured patch +8 / −2
### cw_bitcoin/lib/lightning/lightning_wallet.dart
@@ -60,7 +60,10 @@ class LightningWallet {
if (!logFile.existsSync()) {
logFile.createSync(recursive: true);
}
- logFile.writeAsStringSync("[${logEntry.level}] ${logEntry.line}\n", mode: FileMode.append);
+ logFile.writeAsStringSync(
+ "${DateTime.now().toUtc().toIso8601String()} [${logEntry.level}] ${logEntry.line}\n",
+ mode: FileMode.append,
+ );
} catch (e) {
// Silently fail or use printV(e) so it doesn't crash the app
printV("Failed to write to log: $e");
@@ -70,7 +73,10 @@ class LightningWallet {
if (!logFile.existsSync()) {
logFile.createSync(recursive: true);
}
- logFile.writeAsStringSync("[ERROR] $e\n", mode: FileMode.append);
+ logFile.writeAsStringSync(
+ "${DateTime.now().toUtc().toIso8601String()} [ERROR] $e\n",
+ mode: FileMode.append,
+ );
} catch (err) {
printV("Failed to write error to log: $err");
}Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.