Show
Ignore:
Timestamp:
07/28/07 05:44:23 PM (18 months ago)
Author:
octorian
Message:

More logging code

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/LogicMail/src/org/logicprobe/LogicMail/util/Connection.java

    r135 r136  
    6969import net.rim.device.api.system.EventLogger; 
    7070import org.logicprobe.LogicMail.AppInfo; 
     71import org.logicprobe.LogicMail.conf.GlobalConfig; 
     72import org.logicprobe.LogicMail.conf.MailSettings; 
    7173 
    7274/** 
     
    9597    private StreamConnection socket; 
    9698    private String localAddress; 
     99    private GlobalConfig globalConfig; 
    97100    protected InputStream input; 
    98101    protected OutputStream output; 
     
    126129        this.output = null; 
    127130        this.socket = null; 
     131        this.globalConfig = MailSettings.getInstance().getGlobalConfig(); 
    128132    } 
    129133     
     
    266270         */ 
    267271        if (s.length() == 0) { 
    268             EventLogger.logEvent(AppInfo.GUID, "[SEND]".getBytes(), EventLogger.DEBUG_INFO); 
     272            if(globalConfig.getConnDebug()) { 
     273                EventLogger.logEvent(AppInfo.GUID, "[SEND]".getBytes(), EventLogger.DEBUG_INFO); 
     274            } 
    269275             
    270276            output.write(CRLF, 0, 2); 
     
    286292                } 
    287293                 
    288                 EventLogger.logEvent(AppInfo.GUID, ("[SEND] " + s.substring(i, j)).getBytes(), EventLogger.DEBUG_INFO); 
     294                if(globalConfig.getConnDebug()) { 
     295                    EventLogger.logEvent(AppInfo.GUID, ("[SEND] " + s.substring(i, j)).getBytes(), EventLogger.DEBUG_INFO); 
     296                } 
    289297                 
    290298                /** 
     
    319327        int length = bytes.length; 
    320328         
    321         EventLogger.logEvent(AppInfo.GUID, ("[SEND RAW]\r\n" + s).getBytes(), EventLogger.DEBUG_INFO); 
    322  
     329        if(globalConfig.getConnDebug()) { 
     330            EventLogger.logEvent(AppInfo.GUID, ("[SEND RAW]\r\n" + s).getBytes(), EventLogger.DEBUG_INFO); 
     331        } 
     332         
    323333        output.write(bytes, 0, bytes.length); 
    324334         
     
    389399                 */ 
    390400                if (actual == -1) { 
     401                    EventLogger.logEvent(AppInfo.GUID, "Unable to read from socket, closing connection".getBytes(), EventLogger.INFORMATION); 
    391402                    try { 
    392403                        close(); 
     
    442453        } 
    443454         
    444         EventLogger.logEvent(AppInfo.GUID, ("[RECV] " + resultBuffer.toString()).getBytes(), EventLogger.DEBUG_INFO); 
     455        if(globalConfig.getConnDebug()) { 
     456            EventLogger.logEvent(AppInfo.GUID, ("[RECV] " + resultBuffer.toString()).getBytes(), EventLogger.DEBUG_INFO); 
     457        } 
    445458         
    446459        return resultBuffer.toString();