The "RealTimeLog" plugin allows you to remotely debug an application built on the Solar2D engine in Google Spreadsheets.
To use this plugin, add an entry into the plugins table of build.settings.
settings =
{
android =
{
usesPermissions =
{
"android.permission.INTERNET",
"android.permission.WRITE_EXTERNAL_STORAGE",
},
},
plugins = {
["plugin.realtimelog"] = { publisherId = "com.narkoz" },
},
}
For Android, when using this plugin, don't forget to add the following permissions/features:
- "android.permission.INTERNET"
- "android.permission.WRITE_EXTERNAL_STORAGE"
local realtimelog = require "plugin.realtimelog"
Initializes the realtimelog plugin. This call is required and must be executed before making other realtimelog calls.
realtimelog.init(params)The params table includes parameters for realtimelog initialization.
- deploymentID (required)
String
. Your Deployment ID. See more - How to get Deployment ID.- userID (optional)
String
. User ID for logging. Default isDevice ID
- system.getInfo( "deviceID" ) - Solar2D API.- timeUpdate (optional)
Number
. The delay in updating the log by the plugin in milliseconds. Default is250
ms.- clearOldSession (optional)
Boolean
. Clearing the log on a new session. Default isfalse
.- offlineLog (optional)
Boolean
. Saving the log to a file. If the app was closed before all logs were sent, a next launch of the app will resume sending old logs. Default isfalse
.- debug (optional)
Boolean
. Includes additional debugging information for the plugin. Default isfalse
.
Calling this function clears the log.
realtimelog.clear()
Plugin stop. After calling this function, initialization is required to work with the plugin.
realtimelog.stop()
The realtimelog plugin modifies the standard print function. You must use print in your app. The printout will be sent to the console and your Spreadsheet.
Example:
print( "My Test Print" )
The realtimelog plugin supports 3 types of messages:
- Info - standard message on a white background. Default for
all messages
.- Warning - message on a yellow background.
- Error - message on a red background.
To specify the message type you need to use the
"@type=YOU_TYPE@"
modifier. Where YOU_TYPE is the name of the message type.
Example:
print( "@type=Info@My message about Info" ) print( "@type=Warning@My message about Warning" ) print( "@type=Error@My message about Error" )
Output:
Corona Simulator Console:
You Spreadsheet:
- The plugin is compatible with CatchErrors.
The print function now supports output lua tables.
Example:
local items = { { id = "orange", count = 2, quality = "legend" }, { id = "banana", count = 8, quality = "legend" }, { id = "coconut", count = 14, quality = "legend" }, } print( items )
Output:
[{ "id":"orange", "count":2, "quality":"legend" },{ "id":"banana", "count":8, "quality":"legend" },{ "id":"coconut", "count":14, "quality":"legend" }]
You can generate a unique id from your mask. Plugin initialization is optional.
local uniqueId = realtimelog.getUnic(mask)
- mask (optional)
String
. The mask by which a unique identifier will be generated. Default is"xxxx-xxxx-xxxx"
.
Example:
local uniqueId = realtimelog.getUnic("xx-xx-xxxxxx-xx-xx") print( uniqueId )
Output:
"b8-40-1522f7-10-06"
See more - Solar2dExample