Difference between revisions of "System.Log"

From Xojo Documentation

(SMBot: new page by automated transformation)
 
(Notes)
 
(17 intermediate revisions by 4 users not shown)
Line 4: Line 4:
 
| ownertype=module
 
| ownertype=module
 
| scope=public
 
| scope=public
| parameters=Level as [[Integer]], msg as [[String]]
+
| parameters=level As [[Integer]], msg As [[String]]
| platform=all
+
| project=Desktop, Web, Console
| newinversion=5.5
 
 
}}
 
}}
Writes ''msg'' to the logging mechanism.
+
{{Description
 +
|text = Writes ''msg'' to the logging mechanism. }}
  
On Mac OS X and Linux, it writes to the system logger, which is typically at /var/log. On Windows XP it writes to the Event Logger, which can be viewed by the Event Viewer.
+
==Notes==
  
Use the LogLevel class constants to set the value of ''Level''. See the section "LogLevel Class Constants" for the list of constants.
+
On macOS and Linux, it writes to the system logger, which is typically at /var/log. On Windows it writes to the Event Logger, which can be viewed by the Event Viewer.
  
On Mac OS X, the following levels do not appear in the log: debug, information, and success. This is an OS X issue.
+
{{Information | Log is not supported for Mobile projects.}}
 +
 
 +
{{Information | On macOS, the following levels do not appear in the log: debug, information, and success. This is an macOS issue.}}
 +
 
 +
For debugging purposes, use [[System.DebugLog]] instead.
 +
 
 +
Use the following class constants when setting the value of the ''Level'' parameter in calls to the Log method.
 +
{| class="genericTable"
 +
 
 +
! width=25% | ''Level'' class constants
 +
|-
 +
|System.LogLevelAlert
 +
 
 +
|-
 +
|System.LogLevelCritical
 +
 
 +
|-
 +
|System.LogLevelDebug
 +
 
 +
|-
 +
|System.LogLevelEmergency
 +
 
 +
|-
 +
|System.LogLevelError
 +
 
 +
|-
 +
|System.LogLevelInformation
 +
 
 +
|-
 +
|System.LogLevelNotice
 +
 
 +
|-
 +
|System.LogLevelSuccess
 +
 
 +
|-
 +
|System.LogLevelWarning
 +
 
 +
|-
 +
|}
 +
 
 +
==Example==
 +
For the following example writes your error message with the LogLevelError constant.<br>
 +
<rbcode>
 +
System.Log(System.LogLevelError, "my Error message")
 +
</rbcode>
 +
 
 +
== See Also ==
 +
[[System.DebugLog]]
 +
 
 +
[[Category:Debugging]]
 +
[[Category:Language Debugging]]

Latest revision as of 15:53, 23 February 2022

Method

System.Log(level As Integer, msg As String)

Supported on Desktop, Web, Console.

Writes msg to the logging mechanism.

Notes

On macOS and Linux, it writes to the system logger, which is typically at /var/log. On Windows it writes to the Event Logger, which can be viewed by the Event Viewer.

fa-info-circle-32.png
Log is not supported for Mobile projects.
fa-info-circle-32.png
On macOS, the following levels do not appear in the log: debug, information, and success. This is an macOS issue.

For debugging purposes, use System.DebugLog instead.

Use the following class constants when setting the value of the Level parameter in calls to the Log method.

Level class constants
System.LogLevelAlert
System.LogLevelCritical
System.LogLevelDebug
System.LogLevelEmergency
System.LogLevelError
System.LogLevelInformation
System.LogLevelNotice
System.LogLevelSuccess
System.LogLevelWarning

Example

For the following example writes your error message with the LogLevelError constant.

System.Log(System.LogLevelError, "my Error message")

See Also

System.DebugLog