> For the complete documentation index, see [llms.txt](https://docs.sansar.com/latest/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sansar.com/latest/script-api-docs/sansar-script-namespace/log.md).

# Log

Log, Log.Message, and Log.Level

### Log Class

The Log class handles script logging and error reporting

### Syntax

### Member Details

#### Clear Method

> Clears all messages in this console.
>
> ### Syntax
>
> public [void](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Void) **Clear** ()
>
> ### Remarks
>
> ### Requirements
>
> **Namespace:** Sansar.Script\
> **Assembly:** Sansar.Script (in Sansar.Script.dll)\
> **Assembly Versions:** 1.0.0.0
>
> ***

#### Clear Method

> Clears all messages in this console with the given logLevel.
>
> ### Syntax
>
> **Parameters**
>
> > *logLevel*
> >
> > The LogLevel to clear from the log. Multiple loglevels can be cleared in a single cal.
>
> ### Remarks
>
> ### Requirements
>
> **Namespace:** Sansar.Script\
> **Assembly:** Sansar.Script (in Sansar.Script.dll)\
> **Assembly Versions:** 1.0.0.0
>
> ***

#### Clear Method

> Clears all messages in this console with the given ScriptId.
>
> ### Syntax
>
> **Parameters**
>
> > *scriptId*
> >
> > The ScriptId to clear from the log.
>
> ### Remarks
>
> ### Requirements
>
> **Namespace:** Sansar.Script\
> **Assembly:** Sansar.Script (in Sansar.Script.dll)\
> **Assembly Versions:** 1.0.0.0
>
> ***

#### Clear Method

> Clears all messages in this console with the given tag.
>
> ### Syntax
>
> **Parameters**
>
> > *tag*
> >
> > The tag to clear from the log.
>
> ### Remarks
>
> ### Requirements
>
> **Namespace:** Sansar.Script\
> **Assembly:** Sansar.Script (in Sansar.Script.dll)\
> **Assembly Versions:** 1.0.0.0
>
> ***

#### ConsoleHistory Field

> The maximum number of messages to store on this console.
>
> **Value:** 128
>
> ### Syntax
>
> public const [int](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Int32) **ConsoleHistory**
>
> **Returns**
>
> > The maximum number of messages stored by the console.
>
> ### Remarks
>
> ### Requirements
>
> **Namespace:** Sansar.Script\
> **Assembly:** Sansar.Script (in Sansar.Script.dll)\
> **Assembly Versions:** 1.0.0.0
>
> ***

#### Messages Property

> All current log messages.
>
> ### Syntax
>
> **Value**
>
> > All currently stored log messages.
>
> ### Remarks
>
> ### Requirements
>
> **Namespace:** Sansar.Script\
> **Assembly:** Sansar.Script (in Sansar.Script.dll)\
> **Assembly Versions:** 1.0.0.0
>
> ***

#### Write Method

> Writes a debug message to the server log.
>
> ### Syntax
>
> **Parameters**
>
> > *message*
> >
> > The message to be logged.
>
> ### Remarks
>
> ### Requirements
>
> **Namespace:** Sansar.Script\
> **Assembly:** Sansar.Script (in Sansar.Script.dll)\
> **Assembly Versions:** 1.0.0.0
>
> ***

#### Write Method

> Writes a debug message to the server log.
>
> ### Syntax
>
> **Parameters**
>
> > *logLevel*
> >
> > Message level
> >
> > *message*
> >
> > The message to be logged.
>
> ### Remarks
>
> ### Requirements
>
> **Namespace:** Sansar.Script\
> **Assembly:** Sansar.Script (in Sansar.Script.dll)\
> **Assembly Versions:** 1.0.0.0
>
> ***

#### Write Method

> Writes a debug message to the server log.
>
> ### Syntax
>
> **Parameters**
>
> > *tag*
> >
> > A freeform string tag for filtering the message.
> >
> > *message*
> >
> > The message to be logged.
>
> ### Remarks
>
> ### Requirements
>
> **Namespace:** Sansar.Script\
> **Assembly:** Sansar.Script (in Sansar.Script.dll)\
> **Assembly Versions:** 1.0.0.0
>
> ***

#### Write Method

> Writes a message to the script console.
>
> ### Syntax
>
> **Parameters**
>
> > *logLevel*
> >
> > LogLevel of the message.
> >
> > *tag*
> >
> > Tag for the message.
> >
> > *message*
> >
> > Message to log.
>
> ### Remarks
>
> ### Requirements
>
> **Namespace:** Sansar.Script\
> **Assembly:** Sansar.Script (in Sansar.Script.dll)\
> **Assembly Versions:** 1.0.0.0
>
> ***

### Log.Message Struct

Represents a single console message.

### Syntax

public struct **Log.Message**

### Member Details

#### LogLevel Property

> Message severity for filtering.
>
> ### Syntax
>
> public [LogLevel](https://help.sansar.com/hc/en-us/articles/115005084968) **LogLevel** { get; }
>
> **Value**
>
> > The [Sansar.Script.LogLevel](https://help.sansar.com/hc/en-us/articles/115005084968) of the message.
>
> ### Remarks
>
> ### Requirements
>
> **Namespace:** Sansar.Script\
> **Assembly:** Sansar.Script (in Sansar.Script.dll)\
> **Assembly Versions:** 1.0.0.0
>
> ***

#### ScriptId Property

> Source script id.
>
> ### Syntax
>
> public [ScriptId](https://docs.sansar.com/latest/script-api-docs/sansar-script-namespace/scriptid.md) **ScriptId** { get; }
>
> **Value**
>
> > The [Sansar.Script.ScriptId](https://docs.sansar.com/latest/script-api-docs/sansar-script-namespace/scriptid.md) of the source of the message.
>
> ### Remarks
>
> ### Requirements
>
> **Namespace:** Sansar.Script\
> **Assembly:** Sansar.Script (in Sansar.Script.dll)\
> **Assembly Versions:** 1.0.0.0
>
> ***

#### Tag Property

> Free form tag which can be used to filter messages.
>
> ### Syntax
>
> public [string](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String) **Tag** { get; }
>
> **Value**
>
> > The tag of the message.
>
> ### Remarks
>
> ### Requirements
>
> **Namespace:** Sansar.Script\
> **Assembly:** Sansar.Script (in Sansar.Script.dll)\
> **Assembly Versions:** 1.0.0.0
>
> ***

#### Text Property

> The text of the message.
>
> ### Syntax
>
> public [string](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String) **Text** { get; }
>
> **Value**
>
> > The text of the message.
>
> ### Remarks
>
> ### Requirements
>
> **Namespace:** Sansar.Script\
> **Assembly:** Sansar.Script (in Sansar.Script.dll)\
> **Assembly Versions:** 1.0.0.0
>
> ***

#### TimeStamp Property

> Time the message was written.
>
> ### Syntax
>
> public [DateTime](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.DateTime) **TimeStamp** { get; }
>
> **Value**
>
> > The timestamp of the message.
>
> ### Remarks
>
> ### Requirements
>
> **Namespace:** Sansar.Script\
> **Assembly:** Sansar.Script (in Sansar.Script.dll)\
> **Assembly Versions:** 1.0.0.0
>
> ***

#### ToString Method

> String representation of the message.
>
> ### Syntax
>
> public override [string](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String) **ToString** ()
>
> **Returns**
>
> > String representation of the message.
>
> ### Remarks
>
> ### Requirements
>
> **Namespace:** Sansar.Script\
> **Assembly:** Sansar.Script (in Sansar.Script.dll)\
> **Assembly Versions:** 1.0.0.0
>
> ***

### LogLevel

![Avatar](https://i3.wp.com/help.sansar.com/system/photos/326924166/sansarlogo.png)

[**cara**](https://help.sansar.com/hc/en-us/profiles/18847869348-cara)

May 28, 2019 16:02

[Follow](https://help.sansar.com/hc/en-us/articles/115005084968-LogLevel/subscription.html)

[Sansar.Script](https://help.sansar.com/hc/en-us/articles/115003428207) : [Sansar.Script Namespace](https://help.sansar.com/hc/en-us/articles/115003428207)

[Overview](https://help.sansar.com/hc/en-us/articles/115005084968-LogLevel#T:Sansar.Script.LogLevel)

[Signature](https://help.sansar.com/hc/en-us/articles/115005084968-LogLevel#T:Sansar.Script.LogLevel:Signature)

[Remarks](https://help.sansar.com/hc/en-us/articles/115005084968-LogLevel#T:Sansar.Script.LogLevel:Docs)

[Members](https://help.sansar.com/hc/en-us/articles/115005084968-LogLevel#Members)

[Member Details](https://help.sansar.com/hc/en-us/articles/115005084968-LogLevel#T:Sansar.Script.LogLevel:Members)

### LogLevel Enum

Used by [Sansar.Script.Log](https://help.sansar.com/hc/en-us/articles/115005084908) to filter messages.

### Syntax

\[System.Flags]\
public enum **LogLevel**

### Remarks

### Members

| Member Name | Description                   |
| ----------- | ----------------------------- |
| **Error**   | Error messages.               |
| **Info**    | Basic informational messages. |
| **Warning** | Warning messages.             |

### Requirements

**Namespace:** Sansar.Script\
**Assembly:** Sansar.Script (in Sansar.Script.dll)\
**Assembly Versions:** 1.0.0.0

***
