ApexSQL.Log.Api Send comments on this topic.
Config Class
See Also  Members   Example 



Static class used to configure ApexSQL Log API engine before this one is initialized.

Syntax

Visual Basic (Declaration) 
Public NotInheritable Class Config 
Visual Basic (Usage)Copy Code
Dim instance As Config
C# 
public sealed class Config 
C++/CLI 
public ref class Config sealed 

Example

Example of configuring logging engine
C#Copy Code
static void ConfigureEngine()
{
    
//  Engine configuration has to be done before first reference to Engine class.
    
//  Setup logging file name and folder.
    Config.LoggingConfiguration loggingConfig = 
new Config.LoggingConfiguration();
    loggingConfig.loggingEnabled = 
true;
    loggingConfig.logFileName = String.Format(
"ApexSqlLogApiDemo.{0}.log", DateTime.Now.ToString("yyyyMMddHHmmss"));
    loggingConfig.logFolder = 
"Logs";
    loggingConfig.maximumLogSize = 
20971520;
    loggingConfig.maximumNumberOfLogBackups = 
0;
    Config.ConfigureLogging(loggingConfig);

    
//  Setup logging event handler. This handler is invoked even when logging is disabled.
    Config.OnMessageLogged += 
new Config.MessageLoggedEventHandler(Config_OnMessageLogged);
}

static void Config_OnMessageLogged(LogMessageLevel level, string message)
{
    
//  This handler may be invoked on any thread. If you need to update GUI from it
    
//  you will need to do it indirectly.

    
//  Show only errors and fatal errors.
    
if (level == LogMessageLevel.Info)
    {
        Console.Write(
"{0}", message);
    }
}

Remarks

In general methods in this class should be invoked only before the first reference to Engine class as this will automatically initialized ApexSQL Log API engine.

Inheritance Hierarchy

System.Object
   ApexSql.Log.Config

See Also