skip to navigation
skip to content

OkCat 1.1.1

An powerful log processor

# OkCat

[![Build Status](](

An powerful log processor.


- The adb logcat handler is just update to JakeWharton's nice pidcat and I adapt it for more features.
- You can using this log processor with define you own `log-line-regex` and it can work for any log: iOS, Android, Backend, etc.

## Features

> The most important feature is you can define any regex for any kind of log.

- highlight some keywords
- trans msgs to some words
- trans tags to some words
- hide msg on logs
- separate logs

## How to Install

sudo pip install okcat

If you has not installed `pip` yet, you need to install it first:

1. `brew install python`
2. `sudo easy_install pip`

If you want to upgrade:

sudo pip install okcat --upgrade

## How to Use


#### Simplest test

1. Download: download [filedownloader.yml]( to the current folder or move to the `~/.okcat/` folder
2. Running: run the demo project on [Filedownloader]( repo to your Android phone and connect your Phone to computer
3. Execute: `okcat -y=filedownloader`
4. Done: now, you can checkout the colored logs on terminal, enjoy~



#### 1. Define your config file(`.yml`)

You can create your own `.yaml` file as config file on `~/.okcat/` folder or the current folder you will execute `okcat` command, and the filename is free to choose, when you execute the okcat, we will ask you the configure file name you want to apply.

the following is demo of config file, Of course, you don't have to provide all configs such below, if you think which one is needed, just config that one.

# we will filter out logs with the provided package (name)
# this 'package' keyword is just using for android adb logcat
package: com.liulishuo.filedownloader.demo

# this 'log-line-regex' is just a regex for one line log
# now we support keyword: 'data' 'time' 'level' 'tag' 'process' 'thread' 'message'
# you don't have to provide all keyword, but you have to provide at least the 'message'
# such as: 'message="(\S*)"'
log-line-regex: 'data,time,level,tag,process,thread,message = "(.\S*) *(.\S*) *(\d*) *(\d*) *([A-Z]) *([^:]*): *(.*?)$"'

# on the case of filter logs from Android adb logcat, we using 'adb logcat -v brief -v threadtime' command to obtain logcat
# in the normal case you don't need ot provide this config, because there is a perfect one on the okcat internal
# but if you want to customize the regex log from adb logcat, it's free to define it such below
# adb-log-line-regex: 'data,time,process,thread,level,tag,message="(.\S*) *(.\S*) *(\d*) *(\d*) *([A-Z]) *([^:]*): *(.*?)$"'

# separator regex list
# you can provide multiple regex to separate serial logs
# on this case, if one line log match 'call start Url\[([^\]]*)\]' regex we will separate logs with \n and output a indie line with the '([^\]]*)' value as the title of separate
- 'call start Url\[([^\]]*)\]'

# tag keyword list
# this list keyword is using for filter out which log need to be output
# all provided keyword will be using for compare with each line tag, if a line with tag not contain any keyword on 'tag-keyword-list' it will be ignore to output
- 'FileDownloader'

# translate message map
# if a message on a line start with provide keyword on the 'trans-msg-map' we will add the value of the keyword on the start of the message, and the word of value will be colored to highlight it
# such as this case:
# origin message: 'filedownloader:lifecycle:over xxx'
# after translate: '| Task OVER | filedownloader:lifecycle:over xxx'
'filedownloader:lifecycle:over': 'Task OVER'
'fetch data with': 'Start Fetch'

# translate tag map
# if a tag on a line contain provide keyword on the 'trans-tag-map' we will add the value of the keyword on the start of the message, and the background of the value word will be colored to highlight it
# such as this case:
# origin message: 'FileDownloader.DownloadTaskHunter xxx'
# after translate: 'FileDownloader.DownloadTaskHunter [Status Change] xxx'
'DownloadTaskHunter': '[Status Change]'
'ConnectTask': '[Request]'

# hide message list
# if a message on a line start with provide value on the 'hide-msg-list` and the length of the message is less than 100 word, it would be colored with gray to hide
# here we hide message start with 'notify progress' and '~~~callback' because it is too frequently to output and useless in most case
- 'notify progress'
- '~~~callback'

# highlight list
# if any value on the 'highlight-list' display on any message, the background of the value word would be colored to highlight it
- 'Path['
- 'Url['
- 'Tag['
- 'range['

#### 2. Execute

You can just parse logcat from running adb:

okcat -y=your-conf-name

You also can parse your log file through:

okcat -y=your-conf-name your-log-path

Simplest case for any developer:



Copyright (C) 2017 Jacksgong(

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.
File Type Py Version Uploaded on Size
OkCat-1.1.1.tar.gz (md5) Source 2017-10-10 17KB