Show / Hide Table of Contents

# Class Logger

Provides a simple logging interface. May be replaced with a more robust solution at a later date.

##### Inheritance

System.Object
Logger

##### Inherited Members

System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()

###### Namespace:Microsoft.SqlTools.ServiceLayer.Utility

###### Assembly:Microsoft.SqlTools.ServiceLayer.dll

##### Syntax

    public static class Logger

### Methods

| Improve this Doc View Source

#### Close()

Closes the Logger.

##### Declaration

    public static void Close()

| Improve this Doc View Source

#### Initialize(String, LogLevel, Boolean)

Initializes the Logger for the current session.

##### Declaration

    public static void Initialize(string logFilePath = "sqltools", LogLevel minimumLogLevel = LogLevel.Normal, bool isEnabled = true)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | logFilePath | Optional. Specifies the path at which log messages will be written.
LogLevel | minimumLogLevel | Optional. Specifies the minimum log message level to write to the log file.
System.Boolean | isEnabled |

| Improve this Doc View Source

#### Write(LogLevel, String, String, String, Int32)

Writes a message to the log file.

##### Declaration

    public static void Write(LogLevel logLevel, string logMessage, string callerName = null, string callerSourceFile = null, int callerLineNumber = 0)

##### Parameters

Type | Name | Description
--- | --- | ---
LogLevel | logLevel | The level at which the message will be written.
System.String | logMessage | The message text to be written.
System.String | callerName | The name of the calling method.
System.String | callerSourceFile | The source file path where the calling method exists.
System.Int32 | callerLineNumber | The line number of the calling method.