Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #1671

Re: Terse code sought

From Arved Sandstrom <asandstrom3minus1@eastlink.ca>
Newsgroups comp.lang.java.help
Subject Re: Terse code sought
References <8f7sm7hd60f72vlc47ul8793gvgv9j1a89@4ax.com> <EXrbr.7472$Ce4.1357@newsfe21.iad> <KYwbr.11514$532.1969@newsfe14.iad> <jkoge2$3ch$1@dont-email.me>
Message-ID <fbXbr.22788$pc1.18103@newsfe11.iad> (permalink)
Organization Public Usenet Newsgroup Access
Date 2012-03-26 07:04 -0300

Show all headers | View raw


On 12-03-25 10:23 PM, markspace wrote:
>>> On 12-03-24 04:32 PM, Roedy Green wrote:
>>>> Consider the following code, typical of the sort of thing I pepper my
>>>> code with when debugging.
>>>>
>>>> out.println( "maxBraceNesting:" + maxBraceNesting + "
>>>> maxBracketNesting:" + maxBracketNesting + " maxParenthesisNesting:" +
>>>> maxParenthesisNesting );
> 
>> On 3/24/12 3:32 PM, Arved Sandstrom wrote:
>>> System.out.println("${var} = " + ${var});
> 
> On 3/24/2012 9:14 PM, Daniel Pitts wrote:
>> I'll point out that IntelliJ has a template for this by default. "soutv"
> 
> 
> I just want to point out these each of these is somewhat of a rube
> solution.  A better approach is to use the logger method with parameters:
> 
[ SNIP ]
> 
> Back on topic: no I don't know of a macro that auto generates those for
> you. :)

Point being, without thinking of a macro or some other way to automate
the generation of the logger statement - or *any* approach - you're not
answering Roedy's question.

It should not escape your notice that I could just as easily have
written an Eclipse code template called "logdata" that looks like

logger.log(Level.FINEST, "${var} = {0}", ${var});

and this also addresses Roedy's question. The exact form of the
statement isn't interesting here; it's how you avoid repeated keying of
the same string and hence possible typos.

AHS
-- 
Last week I helped my friend stay put. It's a lot easier'n helpin' 'em
move. I just went over to his house and made sure that he did not start
to load shit into a truck.
-- Mitch Hedberg

Back to comp.lang.java.help | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Terse code sought Roedy Green <see_website@mindprod.com.invalid> - 2012-03-24 12:32 -0700
  Re: Terse code sought Lew <noone@lewscanon.com> - 2012-03-24 14:50 -0700
  Re: Terse code sought Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-03-24 19:32 -0300
    Re: Terse code sought Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-03-24 21:14 -0700
      Re: Terse code sought markspace <-@.> - 2012-03-25 18:23 -0700
        Re: Terse code sought Roedy Green <see_website@mindprod.com.invalid> - 2012-03-25 20:28 -0700
          Re: Terse code sought markspace <-@.> - 2012-03-26 07:59 -0700
        Re: Terse code sought Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-03-26 07:04 -0300
          Re: Terse code sought markspace <-@.> - 2012-03-26 08:02 -0700
            Re: Terse code sought Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-03-26 09:57 -0700
            Re: Terse code sought Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-03-26 20:32 -0300

csiph-web