Nick wrote:

    /* Lazily compute the logger. The computation will not
        start running until the value of 'logger' is actually requested. */
    var logger = lazy({ Logging.getLogger() })

    /* This will start the computation */
    logger.debug("medved")

    /* No delay to compute the logger again, as it has already been
    calculated */
    logger.debug("preved")

It seems you miss the point here: not only logger should be lazy, but all calls to logger's methods:

logger.debug(formatLongMessage(args)); // formatLongMessage should not
                                       // waste CPU cycles if debug
                                       // logging is off



_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to