Skip to content

Improved logcat command, in cblite#101

Merged
snej merged 1 commit intomasterfrom
feature/better-logcat
Dec 11, 2025
Merged

Improved logcat command, in cblite#101
snej merged 1 commit intomasterfrom
feature/better-logcat

Conversation

@snej
Copy link
Copy Markdown
Contributor

@snej snej commented Dec 10, 2025

Note: This requires a LiteCore update: couchbase/couchbase-lite-core#2401

  • Resurrected cblite's logcat subcommand so I can experimentally improve it
  • logcat can now read LiteCore textual log files
  • Output is now formatted in columns
  • Object descriptions are bracketed, and displayed compactly (without the path) after their first appearance
  • Filtering by log level, customizable per log domain
  • Filtering by a substring of the message or object name
  • Filtering by line offset & limit
  • Highlighting (yellow background) a chosen string in the message or an object name
  • Time can be displayed as relative HH:MM::SS.µs since start
  • Can display line numbers (which are stable even if some lines are filtered out)

Example:

$  cblite logcat --lineno --time rel --level warn,Sync:info,DB:info --limit 10 /Users/snej/Downloads/cbllog/files
58210 00:41:39.668405 I Sync  ⏐ ⟦RevFinder#4435 ←Repl#4432 ←C4RemoteRepl#307 ←JRepl@1175308903⟧ Coll=0 Received 200 changes (seq '12260302007'..'12260302884')
58216 00:41:39.669905 I Sync  ⏐ ⟦RevFinder#4435⟧ Coll=0 Responded to 'changes' REQ#2191 w/request for 0 revs in 0.001410 sec
58219 00:41:39.673063 I Sync  ⏐ ⟦Puller#4436 ←Repl#4432 ←C4RemoteRepl#307 ←JRepl@1175308903⟧ Coll=0 activityLevel=busy: pendingResponseCount=0, _caughtUp=0, _pendingRevMessages=0, _activeIncomingRevs=0, _waitingRevMessages=0, _unfinishedIncomingRevs=0
58229 00:41:39.700833 I Sync  ⏐ ⟦Repl#4877 ←C4RemoteRepl#39 ←JRepl@1315833688⟧ CorrID=1833b868 activityLevel=busy: connectionState=2, savingChkpt=0
58231 00:41:39.703137 I Sync  ⏐ ⟦RevFinder#4881 ←Repl#4877 ←C4RemoteRepl#39 ←JRepl@1315833688⟧ Coll=0 Received 200 changes (seq '12281966738'..'12281966937')
58235 00:41:39.704293 I Sync  ⏐ ⟦RevFinder#4881⟧ Coll=0 Responded to 'changes' REQ#434 w/request for 0 revs in 0.001005 sec
58236 00:41:39.704446 I Sync  ⏐ ⟦Puller#4882 ←Repl#4877 ←C4RemoteRepl#39 ←JRepl@1315833688⟧ Coll=0 activityLevel=busy: pendingResponseCount=0, _caughtUp=0, _pendingRevMessages=0, _activeIncomingRevs=0, _waitingRevMessages=0, _unfinishedIncomingRevs=0
58264 00:41:39.741624 I Sync  ⏐ ⟦Repl#4432 ←C4RemoteRepl#307 ←JRepl@1175308903⟧ CorrID=293815e1 activityLevel=busy: connectionState=2, savingChkpt=0
58265 00:41:39.743186 I Sync  ⏐ ⟦RevFinder#4435⟧ Coll=0 Received 200 changes (seq '12260302885'..'12260312710')
58268 00:41:39.744196 I Sync  ⏐ ⟦RevFinder#4435⟧ Coll=0 Responded to 'changes' REQ#2192 w/request for 0 revs in 0.000966 sec
$

@snej snej force-pushed the feature/better-logcat branch 3 times, most recently from dc4b6bf to d08e19a Compare December 11, 2025 00:20
Note: This requires a LiteCore update.

- Resurrected cblite's `logcat` subcommand
- logcat can now read LiteCore textual log files
- Output is now formatted in columns
- Object descriptions are bracketed, and displayed compactly (without
  the path) after their first appearance
- Filtering by log level, customizable per log domain
- Filtering by a substring of the message or object name
- Filtering by line offset & limit
- Highlighting (yellow background) a chosen string in the message
  or an object name
- Time can be displayed as relative HH:MM::SS.µs since start
- Can display line numbers (which are stable even if some lines are
  filtered out)
@snej snej force-pushed the feature/better-logcat branch from d08e19a to 92bb006 Compare December 11, 2025 00:41
@snej snej requested a review from borrrden December 11, 2025 00:51
Copy link
Copy Markdown
Member

@borrrden borrrden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it!

@snej snej merged commit 3e35c06 into master Dec 11, 2025
11 checks passed
@snej snej deleted the feature/better-logcat branch December 15, 2025 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants