NET Logging Library
LogObject<T> Method (ConcreteLog)
Example 



KellermanSoftware.NetLoggingLibrary Namespace > ConcreteLog Class : LogObject<T> Method
Log an object of any type
Syntax
Public Function LogObject(Of T As Class)( _
   ByVal level As LoggingLevel, _
   ByVal value As T _
) As LogResponse
Dim instance As ConcreteLog
Dim level As LoggingLevel
Dim value As T
Dim value As LogResponse
 
value = instance.LogObject(Of T)(level, value)
public LogResponse LogObject<T>( 
   LoggingLevel level,
   T value
)
where T: class
public:
LogResponse^ LogObjectgeneric<typename T>
( 
   LoggingLevel level,
   T^ value
) 
where T: ref class

Parameters

level
value

Type Parameters

T
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
FileTarget fileTarget = new FileTarget(Environment.CurrentDirectory + "\\fileLogger.txt");
logger.Config.Targets.Add(fileTarget);
 
//Create customer object
Customer oCustomer = new Customer();
 
//Assign value to object
oCustomer.ID = 1;
oCustomer.Name = "Peter";
 
//Log oCustomer to Log
logger.LogObject(LoggingLevel.DEBUG, oCustomer);
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 FileTarget(Environment.CurrentDirectory & "\fileLogger.txt")
logger.Config.Targets.Add(fileTarget)
 
'Create customer object
Dim oCustomer As New Customer()
 
'Assign value to object
oCustomer.ID = 1
oCustomer.Name = "Peter"
 
'Log oCustomer to Log
logger.LogObject(LoggingLevel.DEBUG, oCustomer)
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