commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 32691] - [logging] Convenience methods for cleaner application code
Date Tue, 14 Dec 2004 11:28:45 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=32691>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=32691





------- Additional Comments From bob.tarling@gmail.com  2004-12-14 12:28 -------
This is some slight adjustments to Linus original suggestion


    void debug(Object mess1, Object mess2) {
        if (isDebugEnabled()) {
            debug(new StringBuffer(mess1).append(mess2));
        }
    }
    void debug(Object mess1, Object mess2, Object mess3) {
        if (isDebugEnabled()) {
            debug(new StringBuffer(mess1).append(mess2).append(mess3));
        }
    }
    void debug(Object mess1, Object mess2, Object mess3, Object mess4) {
        if (isDebugEnabled()) {
            debug(new StringBuffer(mess1).append(mess2).append(mess3).append
(mess4));
        }
    }
    void debug(Object mess1, Object mess2, Object mess3, Object mess4, Object 
mess5) {
        if (isDebugEnabled()) {
            debug(new StringBuffer(mess1).append(mess2).append(mess3).append
(mess4).append(mess5));
        }
    }


This would allow code such as this in an application -

    String value = (String)myMap.get(key);
    if (log.isDebugEnabled()) {
        log.debug("Got the value " + value + " from the map with key " + key);
    }

to be reduced down to -

    String value = (String)myMap.get(key);
    log.debug("Got the value ", value, " from the map with key ", key);

removing the clutter from the application.


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message