开发者

Is searching on android DDMS LOG possible?

Any way to search within DDMS Log using some simple way more similar to (CTRL + F). I know of filtering by LOG_TAG 开发者_开发问答as well other simple way to copy-paste in a text document to do CTRL+F.


If you are talking about Eclipse there isn't such search tool.

Here is my way to explore logs.

Rredircting adb shell output to the logfile.

adb logcat > device.log

Then explore logfile with vim. The only problem is that vim doesn't automatically reload file on change. So I adapted vim filtering script to reload file on every search, just adding edit! line before search performing (line 8).

" Gather search hits, and display in a new scratch buffer.
function! Gather(pattern)
  if !empty(a:pattern)
    let save_cursor = getpos(".")
    let orig_ft = &ft
    " append search hits to results list
    let results = []
    edit!
    execute "g/" . a:pattern . "/call add(results, getline('.'))"
    call setpos('.', save_cursor)
    if !empty(results)
      " put list in new scratch buffer
      new
      setlocal buftype=nofile bufhidden=hide noswapfile
      execute "setlocal filetype=".orig_ft
      call append(1, results)
      1d  " delete initial blank line
    endif
  endif
endfunction

" Delete the current buffer if it is a scratch buffer (any changes are lost).
function! CloseScratch()
  if &buftype == "nofile" && &bufhidden == "hide" && !&swapfile
    " this is a scratch buffer
    bdelete
    return 1
  endif
  return 0
endfunction

nnoremap <silent> <Leader>f :call Gather(input("Search for: "))<CR>
nnoremap <silent> <Leader>F :call Gather(@/)<CR>
nnoremap <silent> <Esc> :call CloseScratch()<CR>

Now when using \f of \F for search, buffer is automatically reloading. Check script's vikia page for more information.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜