Log

Sansar.Script.Log

Log Class

The Log class handles script logging and error reporting

Syntax

public class Log : InstanceInterface

Remarks

A simple script for viewing the log messages might be:

C# Example
              

Requirements

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

Members

See Also: Inherited members from InstanceInterface.

Public Fields

const
ConsoleHistory int (128). The maximum number of messages to store on this console.

Public Properties

[read-only]
 
IsValid bool . Whether or not this interface is valid. (Inherited from InstanceInterface.)
[read-only]
 
Messages IEnumerable<Log.Message> . All current log messages.

Public Methods

  Clear ()
Clears all messages in this console.
  Clear (LogLevel)
Clears all messages in this console with the given logLevel.
  Clear (ScriptId)
Clears all messages in this console with the given ScriptId.
  Clear (string)
Clears all messages in this console with the given tag.
  Write (string)
Writes a debug message to the server log.
  Write (LogLevel, string)
Writes a debug message to the server log.
  Write (string, string)
Writes a debug message to the server log.
  Write (LogLevel, string, string)
Writes a message to the script console.

Member Details

Clear Method

Clears all messages in this console.

Syntax

public void Clear ()

Remarks

Messages cannot be restored.

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

public void Clear (LogLevel logLevel)

Parameters

logLevel
The LogLevel to clear from the log. Multiple loglevels can be cleared in a single cal.

Remarks

Messages cannot be restored.

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

public void Clear (ScriptId scriptId)

Parameters

scriptId
The ScriptId to clear from the log.

Remarks

Messages cannot be restored.

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

public void Clear (string tag)

Parameters

tag
The tag to clear from the log.

Remarks

Messages cannot be restored.

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 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

public IEnumerable<Log.Message> Messages { get; }

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

public void Write (string message)

Parameters

message
The message to be logged.

Remarks

Log messages may be throttled.

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

public void Write (LogLevel logLevel, string message)

Parameters

logLevel
Message level
message
The message to be logged.

Remarks

Log messages may be throttled.

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

public void Write (string tag, string message)

Parameters

tag
A freeform string tag for filtering the message.
message
The message to be logged.

Remarks

Log messages may be throttled.

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

public void Write (LogLevel logLevel, string tag, string message)

Parameters

logLevel
LogLevel of the message.
tag
Tag for the message.
message
Message to log.

Remarks

Also tracks the sending script and the time. Only the last Log.ConsoleHistory messages are retained.

Requirements

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


Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Article is closed for comments.