Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-4213

add a local transform for logging

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 1.8-beta-1
    • None
    • None

    Description

      At the GR8 conference in Kobenhagen a group decided to write a local transform to supply an injection like logging ability as part of the hackergarten. This transform injects a field named log, initialized with a logger java.util.Logger and will replace all method calls on all free variables named "log" with an surrounding if to avoid the evaluation of costly expressions

      log.info(database.getTheQuestionFor42()) //takes a lot of time
      

      will be transformed to

      if (log.isLoggable(Level.INFO)) {           // doesn't take long
        log.info(database.getTheQuestionFor42())  // this still does
      }
      

      Attachments

        Issue Links

          Activity

            People

              blackdrag Jochen Theodorou
              blackdrag Jochen Theodorou
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: