我一直在使用JakeWharton的pidcat来查看我的应用程序的日志:
$ pidcat [org.test.myapp]
并将其重定向到文件:
$ pidcat [org.test.myapp] > ~/Dev/myapp_log
pidcat生成非常突出显示的内容,我尝试将其保存在pdf文件中。我试过了:
$ cupsfilter ~/Dev/myapp_log ~/Dev/myapp_log.pdf
但它只是将纯白文本生成为pdf。
我怎样才能在pdf文件中保留漂亮的高亮格式?附:这是一个很长的日志。不能只是打印屏幕..
这是原始输出的样子:
这是Mac上默认打开的部分pidcat输出:
[107m [0m Process created for broadcast com.nortek.app/org.videolan.vlc.PhoneStateReceiver
[107m [0m PID: 9718 UID: 10157 GIDs: {50157, 3003, 1028, 1015}
[101m [0m Process 9718 ended
[107m [0m Process created for activity com.nortek.app/.ui.activity.DummyMainActivity
[107m [0m PID: 2840 UID: 10157 GIDs: {50157, 3003, 1028, 1015}
[31mek.app.common.ApiAgent[0m [30;104m D [0m @ Ready to send out GET_ALL_DATA : http://192.168.11.59:8083/ZWaveAPI/data/0
[37m ActivityManager[0m [30;102m I [0m Timeline: Activity_idle id: android.os.BinderProxy@4181e268 time:34298679
[32mvity.DummyMainActivity[0m [30;104m D [0m @ nav item click id : 5/Camera
[33m Volley[0m [30;101m E [0m [1] 1.onErrorResponse: Error GET_ALL_DATA :
[30;104m D [0m [1] Request.finish: 3076 ms: [ ] http://192.168.11.59:8083/ZWaveAPI/data/0 0x85bd6053 NORMAL 3
[34mSpannableStringBuilder[0m [30;101m E [0m SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
[30;101m E [0m SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
[35m VLC/AudioService[0m [37;100m V [0m Loading position 0 in [rtsp://192.168.11.40:5454/live]
[37;100m V [0m Creating on-the-fly Media object for rtsp://192.168.11.40:5454/live
[36m VLC[0m [30;104m D [0m core libvlc: no fetch required for (null) (art currently (null))
[30;104m D [0m core demux meta: looking for meta fetcher module matching "any": 0 candidates
[30;104m D [0m core demux meta: no meta fetcher modules
[30;104m D [0m core libvlc: searching art for rtsp://192.168.11.40:5454/live
[30;104m D [0m core art finder: looking for art finder module matching "any": 1 candidates
[30;104m D [0m core art finder: no art finder modules matched
[30;104m D [0m core libvlc: art not found for rtsp://192.168.11.40:5454/live
[31m VLC/LibVLC/Media[0m [30;104m D [0m Title rtsp://192.168.11.40:5454/live
[30;104m D [0m Artist Unknown Artist
[30;104m D [0m Genre Unknown Genre
[30;104m D [0m Album Unknown Album
[36m VLC[0m [30;104m D [0m core input: Creating an input for 'rtsp://192.168.11.40:5454/live'
答案 0 :(得分:2)
首先,您必须将彩色shell输出转换为html,然后转换为pdf。
使用here
中的ansi2html.sh
你可以尝试这样的smth
cat myapp_log | ansi2html.sh -p > myapp_log.html
html2any myapp_log.html file.pdf