Reference API Roblox

Engine API

Website

Related

Reference API Roblox

LogService

A service that allows you to read outputted text.

This class is not creatable. Instances of this class cannot be created with Instance.new.
This class is a service. It is a singleton that may be acquired with GetService.
Tags: [NotCreatable, Service]

Member index 18

HistoryMember
582ClearOutput(): null
716Error(message: string, context: Dictionary = nil): null
573ExecuteScript(source: string): null
462GetHttpResultHistory(): Array
462GetLogHistory(): Array
716Info(message: string, context: Dictionary = nil): null
716Log(messageType: MessageType, message: string, context: Dictionary = nil): null
716Output(message: string, context: Dictionary = nil): null
573RequestHttpResultApproved(): null
573RequestServerHttpResult(): null
573RequestServerOutput(): null
716Warn(message: string, context: Dictionary = nil): null
462HttpResultOut(httpResult: Dictionary)
716MessageOut(message: string, messageType: MessageType, context: Dictionary)
462OnHttpResultApproved(isApproved: bool)
722ServerContextOut(contextData: Dictionary)
462ServerHttpResultOut(httpResult: Dictionary)
512ServerMessageOut(message: string, messageType: MessageType, timestamp: double)
inherited from Instance
726Archivable: bool
726Capabilities: SecurityCapabilities
726IsInSandbox: bool
726Name: string
726Parent: Instance
726PredictionMode: PredictionMode
726Sandboxed: bool
726UniqueId: UniqueId
576AddTag(tag: string): null
573ClearAllChildren(): null
462Clone(): Instance
573Destroy(): null
486FindFirstAncestor(name: string): Instance
486FindFirstAncestorOfClass(className: string): Instance
486FindFirstAncestorWhichIsA(className: string): Instance
486FindFirstChild(name: string, recursive: bool = false): Instance
486FindFirstChildOfClass(className: string): Instance
486FindFirstChildWhichIsA(className: string, recursive: bool = false): Instance
486FindFirstDescendant(name: string): Instance
563GetActor(): Actor
486GetAttribute(attribute: string): Variant
462GetAttributeChangedSignal(attribute: string): RBXScriptSignal
631GetAttributes(): Dictionary
648GetChildren(): Instances
462GetDebugId(scopeLength: int = 4): string
707GetDescendants(): Instances
486GetFullName(): string
706GetStyled(name: string, selector: string?): Variant
657GetStyledPropertyChangedSignal(property: string): RBXScriptSignal
576GetTags(): Array
576HasTag(tag: string): bool
486IsAncestorOf(descendant: Instance): bool
486IsDescendantOf(ancestor: Instance): bool
664IsPropertyModified(property: string): bool
698QueryDescendants(selector: string): Instances
573Remove(): null
576RemoveTag(tag: string): null
664ResetPropertyToDefault(property: string): null
573SetAttribute(attribute: string, value: Variant): null
462WaitForChild(childName: string, timeOut: double): Instance
726children(): Instances
726clone(): Instance
726destroy(): null
726findFirstChild(name: string, recursive: bool = false): Instance
726getChildren(): Instances
726isDescendantOf(ancestor: Instance): bool
726remove(): null
462AncestryChanged(child: Instance, parent: Instance)
462AttributeChanged(attribute: string)
462ChildAdded(child: Instance)
462ChildRemoved(child: Instance)
462DescendantAdded(descendant: Instance)
462DescendantRemoving(descendant: Instance)
500Destroying()
657StyledPropertiesChanged()
726childAdded(child: Instance)
inherited from Object
726ClassName: string
726className: string
647GetPropertyChangedSignal(property: string): RBXScriptSignal
647IsA(className: string): bool
726isA(className: string): bool
647Changed(property: string)

Removed member index 6

HistoryMember

Description

LogService allows you to log structured log entries and read outputted text.

Template Syntax

Methods that accept a context table support {key} template placeholders in the message string. To include a literal brace character in the output, use double braces: {{ produces a literal { and }} produces a literal }.

1
2
3
4
local LogService = game:GetService("LogService")

LogService:Info("Value = {{result}}: {val}", {val = 42})
-- Output: "Value = {result}: 42"

Warning

This service might have unexpected or unreliable behavior and content might be truncated. Don't rely on contents of events and messages emitted by this service for any important game logic.

History 48

Members 18

ClearOutput

Parameters (0)
No parameters.
Returns (1)
null

Clears Roblox Studio's Output window. The log history is also cleared, such that LogService:GetLogHistory() will not return any entries from before the ClearOutput() call.

History 1

Error

Parameters (2)Default
messagestring
contextDictionarynil
Returns (1)
null

Logs a message at the MessageType.MessageError level and throws a structured error with optional context. As this method always throws, use pcall() to catch the error. The thrown error is a table with message, template, context, and stack fields, and a __tostring metamethod that returns the rendered message.

When a context table is provided, template placeholders like {key} in the message are replaced with the corresponding context values.

1
2
3
4
5
6
7
8
9
local LogService = game:GetService("LogService")

local ok, err = pcall(function()
	LogService:Error("Failed: {reason}", {reason = "timeout"})
end)
-- ok is false
-- err.message == "Failed: timeout"
-- err.context == {reason = "timeout"}
-- tostring(err) == "Failed: timeout"
This function has a custom internal state. It may behave in a non-standard way.

History 1

Tags: [CustomLuaState]

ExecuteScript

Parameters (1)
sourcestring
Returns (1)
null

History 3

GetHttpResultHistory

Parameters (0)
No parameters.
Returns (1)
Array

History 2

GetLogHistory

Parameters (0)
No parameters.
Returns (1)
Array

Returns a table of tables, each with the message string, message type, and timestamp of a message that the client displays in the Output window.

History 2

HttpResultOut

Parameters (1)
httpResultDictionary

History 2

Info

Parameters (2)Default
messagestring
contextDictionarynil
Returns (1)
null

Logs a message at the MessageType.MessageInfo level. When a context table is provided, template placeholders like {key} in the message are replaced with the corresponding context values. The context is preserved as structured data for display in the Developer Console and Studio's Output window.

1
2
3
4
local LogService = game:GetService("LogService")

LogService:Info("User {name} has {count} items", {name = "Alice", count = 42})
-- Output: "User Alice has 42 items"
This function has a custom internal state. It may behave in a non-standard way.

History 1

Tags: [CustomLuaState]

Log

Parameters (3)Default
messageTypeMessageType
messagestring
contextDictionarynil
Returns (1)
null

Logs a message at the specified MessageType level. This is a general-purpose method that combines the functionality of Output(), Info(), Warn(), and Error() into a single call with an explicit message type parameter.

When messageType is MessageType.MessageError, this method throws a structured error object (same behavior as Error()).

1
2
3
local LogService = game:GetService("LogService")

LogService:Log(Enum.MessageType.MessageInfo, "Event {action}", {action = "click"})
This function has a custom internal state. It may behave in a non-standard way.

History 1

Tags: [CustomLuaState]

MessageOut

Parameters (3)
messagestring
messageTypeMessageType
contextDictionary

Fires when the client outputs text.

History 3

OnHttpResultApproved

Parameters (1)
isApprovedbool

History 2

Output

Parameters (2)Default
messagestring
contextDictionarynil
Returns (1)
null

Logs a message at the MessageType.MessageOutput level. When a context table is provided, template placeholders like {key} in the message are replaced with the corresponding context values. The context is preserved as structured data for display in the Developer Console and Studio's Output window.

1
2
3
4
local LogService = game:GetService("LogService")

LogService:Output("Player {name} joined", {name = "Alice"})
-- Output: "Player Alice joined"
This function has a custom internal state. It may behave in a non-standard way.

History 1

Tags: [CustomLuaState]

RequestHttpResultApproved

Parameters (0)
No parameters.
Returns (1)
null

History 3

RequestServerHttpResult

Parameters (0)
No parameters.
Returns (1)
null

History 3

RequestServerOutput

Parameters (0)
No parameters.
Returns (1)
null

History 3

ServerContextOut

Parameters (1)
contextDataDictionary

History 1

ServerHttpResultOut

Parameters (1)
httpResultDictionary

History 2

ServerMessageOut

Parameters (3)
messagestring
messageTypeMessageType
timestampdouble

History 3

Warn

Parameters (2)Default
messagestring
contextDictionarynil
Returns (1)
null

Logs a message at the MessageType.MessageWarning level with optional structured context. When a context table is provided, template placeholders like {key} in the message are replaced with the corresponding context values. The context is preserved as structured data for display in the Developer Console and Studio's Output window.

1
2
3
4
local LogService = game:GetService("LogService")

LogService:Warn("Memory usage at {pct}%", {pct = 95})
-- Output: "Memory usage at 95%"
This function has a custom internal state. It may behave in a non-standard way.

History 1

Tags: [CustomLuaState]

Removed members 6

Settings