Snippets

SeanB Quick Logging

You are viewing an old version of this snippet. View the current version.
Revised by SeanB 5373884
Global_Variable Integer ghlogfile 
Object oSimpleLog is a cObject
    Property String psPrivate.LogName 
    
    Procedure Set logfile String sName 
        String sFolder 
        Get psHome of (phoWorkspace(oApplication)) to sFolder 
        If ((Right(sFolder,1))<>"\") Append sFolder "\"
        Append sFolder sName 
        Set  psPrivate.LogName to sFolder 
    End_Procedure
    
    Function logfile Returns String 
        Function_Return ( psPrivate.LogName (Self))
    End_Function
    
    Procedure QuickLog String sText 
        Integer iCH 
        DateTime dtNow
    
        Move (CurrentDateTime()) to dtNow
        Move ("["+(String(dtNow)) +"] "+  sText) to sText 
        
        Get Seq_New_Channel to iCH 
        Append_Output channel iCH (logfile(Self)) 
        Writeln channel iCH sText 
        Close_Output channel iCH 
        Send Seq_Release_Channel iCH 
    End_Procedure
    
    Move (Self) to ghlogfile
End_Object

Procedure QuickLog Global String sMessage 
    Send QuickLog to ghLogFile sMessage  
End_Procedure
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.