5

LogCat output in its color highlighting is very informative and helpful in isolating problems. Sometimes, however, I need to print it to paper (or copy/paste it to an OpenOffice.org Writer document) with the colors!

Is there a way to print LogCat output with the color highlighting? (or at least copy/paste it without losing the color information)?

ef2011
  • 10,431
  • 12
  • 49
  • 67

2 Answers2

1

Am assuming LogCat output can be opened in a VIM IDE. I found this link - http://vimdoc.sourceforge.net/htmldoc/usr_06.html#06.5 which talks about how to print (along with colors). It also talks about how to save to an HTML. Try this out. May help.

Nitin Unni
  • 358
  • 1
  • 6
  • Thanks! +1. I am currently using LogCat via Eclipse. I don't even have VIM installed on my PC. Where do I learn more about the VIM IDE? Can you provide a link to instructions how to use LogCat with VIM instead of Eclipse? – ef2011 May 10 '11 at 11:46
  • @ef2011 - Found these links. I did not try it myself but looking thru what they said trying them out should work... (1) What is VIM etc etc http://www.vim.org/about.php ... (2) A script for logcat in VIM http://www.vim.org/scripts/script.php?script_id=2735 – Nitin Unni May 13 '11 at 17:58
0

I'm afraid I don't have a solution for highlighting inside Eclipse, but if you're using gedit on Debian, you can use this language highlighter I wrote:

<?xml version="1.0" encoding="UTF-8"?>
<language id="logcat" _name="logcat" version="2.0" _section="Others">
    <metadata>
        <property name="mimetypes">text/x-logcat</property>
        <property name="globs">*.logcat</property>
    </metadata>

    <styles>
        <style id="comment" _name="Comment" map-to="def:comment"/>
        <style id="verbose" _name="Verbose" map-to="def:identifier"/>
        <style id="debug"   _name="Debug"   map-to="def:preprocessor"/>
        <style id="info"    _name="Info"    map-to="def:type"/>
        <style id="warning" _name="Warning" map-to="def:constant"/>
        <style id="error"   _name="Error"   map-to="def:keyword"/>
        <style id="fatal"   _name="Fatal"   map-to="def:error"/>
        <style id="others"  _name="Others"  map-to="def:comment"/>
    </styles>

    <definitions>
        <context id="logcat">
            <include>
                <context id="comment" style-ref="comment">
                    <start>--</start>
                    <end>$</end>
                </context>
                <context id="comment" style-ref="comment">
                    <start>#</start>
                    <end>$</end>
                </context>
                <context id="datetime" style-ref="comment">
                    <start>^[0-9]</start>
                    <end>: </end>
                </context>

                <context id="verbose" style-ref="verbose">
                    <start>V/</start>
                    <end>$</end>
                </context>

                <context id="debug" style-ref="debug">
                    <start>D/</start>
                    <end>$</end>
                </context>

                <context id="info" style-ref="info">
                    <start>I/</start>
                    <end>$</end>
                </context>

                <context id="warning" style-ref="warning">
                    <start>W/</start>
                    <end>$</end>
                </context>

                <context id="error" style-ref="error">
                    <start>E/</start>
                    <end>$</end>
                </context>

                <context id="fatal" style-ref="fatal">
                    <start>F/</start>
                    <end>$</end>
                </context>
            </include>
        </context>
    </definitions>
</language>
Paul Lammertsma
  • 37,593
  • 16
  • 136
  • 187