C# Class NetworkCommsDotNet.Tools.LogTools

Quickly log exceptions and information to a file.
Mostra file Open project: MarcFletcher/NetworkComms.Net Class Usage Examples

Public Methods

Method Description
AppendStringToLogFile ( string fileName, string logString ) : void

Appends the provided logString to end of fileName.txt. If the file does not exist it will be created.

LogException ( Exception ex, string fileName, string optionalCommentStr = "" ) : string

Logs the provided exception to a file to assist troubleshooting.

Method Details

AppendStringToLogFile() public static method

Appends the provided logString to end of fileName.txt. If the file does not exist it will be created.
public static AppendStringToLogFile ( string fileName, string logString ) : void
fileName string The filename to use. The extension .txt will be appended automatically
logString string The string to append.
return void

LogException() public static method

Logs the provided exception to a file to assist troubleshooting.
public static LogException ( Exception ex, string fileName, string optionalCommentStr = "" ) : string
ex System.Exception The exception to be logged
fileName string The filename to use. A time stamp and extension .txt will be appended automatically
optionalCommentStr string An optional string which will appear at the top of the error file
return string