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



KellermanSoftware.NetLoggingLibrary Namespace > ConcreteLog 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 Function LogAttachment( _
   ByVal level As LoggingLevel, _
   ByVal message As String, _
   ByVal filePath As String _
) As LogResponse
Dim instance As ConcreteLog
Dim level As LoggingLevel
Dim message As String
Dim filePath As String
Dim value As LogResponse
 
value = instance.LogAttachment(level, message, filePath)
public LogResponse LogAttachment( 
   LoggingLevel level,
   string message,
   string filePath
)
public:
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
ConcreteLog logger = new ConcreteLog();
 
//Licensed Mode
//logger.UserName = "User Name From Receipt";
//logger.LicenseKey = "LicenseKey From Receipt";            
 
//Clear all configuration
logger.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");
logger.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
logger.LogAttachment(LoggingLevel.DEBUG, "Test Message", "Test.txt");
Dim logger As New ConcreteLog()
 
'Licensed Mode
'logger.UserName = "User Name From Receipt";
'logger.LicenseKey = "LicenseKey From Receipt";            
 
'Clear all configuration
logger.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")
logger.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
logger.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

ConcreteLog Class
ConcreteLog Members
Overload List