# log levels available for various log commands
log_level<native><public> := enum:
Debug
Verbose
Normal
Warning
Error
# log_channel is the base class used to define log channels. When printing a message to a log, the log channel class name will be prefixed to the output message.
log_channel<native><public> := class<abstract>:
# log class to send messages to the default log
log<native><public> := class:
# Channel class name will be added as a prefix used when printing the message e.g. '[log_channel]: #Message
Channel<native><public>:subtype(log_channel)
# Sets the default log level of the displayed message. See log_level enum for more info on log levels. Defaults to log_level.Normal.
DefaultLevel<native><public>:log_level = external {}
# Print message using the given log level
(log:)Print<native><public>(Message:string, ?Level:log_level = external {})<computes>:void
# Prints current script call stack using the give log level
PrintCallStack<native><public>(?Level:log_level = external {})<computes>:void
using { /UnrealEngine.com/Temporary/Diagnostics }
my_log_channel<public> := class(log_channel):
# A project-wide "Logger" to print messages from functions that are not in a class with a log.
# The non-Logger Print is <no_rollback>, so it can't be used in a <transacts> function.
ProjectLog<public>(Message:[]char, ?Level:log_level = log_level.Normal)<transacts>:void=
Logger := log{Channel := my_log_channel}
Logger.Print(Message, ?Level := Level)
# Usage:
ProjectLog("EndGame: Player has won!", ?Level := log_level.Verbose)
# You don't have to specify the Level
ProjectLog("Hello Verse!")
コメント