NET Logging Library
LogDataView Method (ConcreteLog)
Example 



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

Parameters

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

ConcreteLog Class
ConcreteLog Members