NET Logging Library
LogDataTable Method (Log)
Example 



KellermanSoftware.NetLoggingLibrary Namespace > Log Class : LogDataTable Method
Log a data table
Syntax
Public Shared Function LogDataTable( _
   ByVal level As LoggingLevel, _
   ByVal table As DataTable, _
   ByVal maxRows As Integer _
) As LogResponse
Dim level As LoggingLevel
Dim table As DataTable
Dim maxRows As Integer
Dim value As LogResponse
 
value = Log.LogDataTable(level, table, maxRows)
public static LogResponse LogDataTable( 
   LoggingLevel level,
   DataTable table,
   int maxRows
)
public:
static LogResponse^ LogDataTable( 
   LoggingLevel level,
   DataTable^ table,
   int maxRows
) 

Parameters

level
table
maxRows
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
FileTarget fileTarget = new FileTarget(Environment.CurrentDirectory + "\\fileLogger.txt");
Log.Config.Targets.Add(fileTarget);
 
//Create a test DataTable
DataTable table = new DataTable();
 
//Add columns
table.Columns.Add("CustomerID", typeof(int));
table.Columns.Add("CustomerName", typeof(string));
table.Columns.Add("Country", typeof(string));
 
//Add row to table
table.Rows.Add(new object[] { 1, "Bat Man", "England" });
table.Rows.Add(new object[] { 2, "Cat Woman", "US" });
 
//Log datatable to log
Log.LogDataTable(LoggingLevel.DEBUG, table, 2);
'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 FileTarget(Environment.CurrentDirectory & "\fileLogger.txt")
Log.Config.Targets.Add(fileTarget)
 
'Create a test DataTable
Dim table As New DataTable()
 
'Add columns
table.Columns.Add("CustomerID", GetType(Integer))
table.Columns.Add("CustomerName", GetType(String))
table.Columns.Add("Country", GetType(String))
 
'Add row to table
table.Rows.Add(New Object() { 1, "Bat Man", "England" })
table.Rows.Add(New Object() { 2, "Cat Woman", "US" })
 
'Log datatable to log
Log.LogDataTable(LoggingLevel.DEBUG, table, 2)
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