NET Logging Library
LogAttachment(LoggingLevel,String,String) Method
Example 



KellermanSoftware.NetLoggingLibrary Namespace > Log Class > LogAttachment Method : LogAttachment(LoggingLevel,String,String) Method
The logging level
The message to log with the attachment
A file to log inside the binary target
Log an attachment to the BinaryFileTarget. If no binary target is attached, nothing will be logged
Syntax
Public Overloads Shared Function LogAttachment( _
   ByVal level As LoggingLevel, _
   ByVal message As String, _
   ByVal filePath As String _
) As LogResponse
Dim level As LoggingLevel
Dim message As String
Dim filePath As String
Dim value As LogResponse
 
value = Log.LogAttachment(level, message, filePath)
public static LogResponse LogAttachment( 
   LoggingLevel level,
   string message,
   string filePath
)
public:
static LogResponse^ LogAttachment( 
   LoggingLevel level,
   String^ message,
   String^ filePath
) 

Parameters

level
The logging level
message
The message to log with the attachment
filePath
A file to log inside the binary target
Example
//Licensed Mode
//Log.UserName = "User Name From Receipt";
//Log.LicenseKey = "LicenseKey From Receipt";            
 
//Clear all configuration
Log.ResetConfiguration();
 
//Add a new target, you can also define targets in an xml file, app.config, or web.config
BinaryFileTarget fileTarget = new BinaryFileTarget("fileLogger.bin");
Log.Config.Targets.Add(fileTarget);        
 
//Create an attachment
File.WriteAllText("Test.txt", "This is a test");
 
//This will log an attachment just to the binary logger
Log.LogAttachment(LoggingLevel.DEBUG, "Test Message", "Test.txt");
'Licensed Mode
'Log.UserName = "User Name From Receipt";
'Log.LicenseKey = "LicenseKey From Receipt";            
 
'Clear all configuration
Log.ResetConfiguration()
 
'Add a new target, you can also define targets in an xml file, app.config, or web.config
Dim fileTarget As New BinaryFileTarget("fileLogger.bin")
Log.Config.Targets.Add(fileTarget)
 
'Create an attachment
File.WriteAllText("Test.txt", "This is a test")
 
'This will log an attachment just to the binary logger
Log.LogAttachment(LoggingLevel.DEBUG, "Test Message", "Test.txt")
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

Log Class
Log Members
Overload List