NET Logging Library
LogDataView Method (Log)
Example 



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

Parameters

level
view
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);
 
//Convert table to dataview.
DataView view = new DataView(table);
view.RowFilter = "CustomerID=2";
 
//Log dataview  to log
Log.LogDataView(LoggingLevel.DEBUG, view, 1);
'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)
 
'Convert table to dataview.
Dim view As New DataView(table)
view.RowFilter = "CustomerID=2"
 
'Log dataview  to log
Log.LogDataView(LoggingLevel.DEBUG, view, 1)
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