Skip to main content
Version: 5.11.4

InsertLog

public BackendReturnObject InsertLog(string logType, Param param);
public BackendReturnObject InsertLog(string logType, Param param, int graceDays);

Parameters

ValueTypeDescription
logTypestringType used to classify logs
paramstringParam that includes the content to be recorded in logs
graceDaysintReserved date for deletion(If graceDays is 10, the log is deleted automatically after 10 days)

Description

Game logs are stored.
You can check the created logs in BACKND Console and the game client.

graceDays

graceDays defines the grace period.
If you enter 10 for graceDays, the log is deleted automatically after 10 days of insertion.
If you enter a number no more than 0 or do not enter any number, graceDays is set to 90(3 months).

Example

Synchronous

Param param = new Param();
param.Add("n_n", "tableName");
Backend.GameLog.InsertLog("logType", param);

//If the desired period of log storage is up to 10 days
Backend.GameLog.InsertLog("logType", param, 10);

Asynchronous

Param param = new Param();
param.Add("n_n", "tableName");
Backend.GameLog.InsertLog("logType", param, (callback) =>
{
// Post-process
});

//If the desired period of log storage is up to 10 days
Backend.GameLog.InsertLog("logType", param, 10, (callback) =>
{
// Post-process
});

SendQueue

Param param = new Param();
param.Add("n_n", "tableName");
SendQueue.Enqueue(Backend.GameLog.InsertLog, "logType", param, (callback) =>
{
// Post-process
});

//If the desired period of log storage is up to 10 days
SendQueue.Enqueue(Backend.GameLog.InsertLog, "logType", param, 10, (callback) =>
{
// Post-process
});

Return cases

Success cases

When the log is created successfully
statusCode : 204

Sample code

public void InsertLogTest()
{
long money = 12345678;
int level = 100;

Dictionary<string, int> items = new Dictionary<string, int> { { "hpPotion", 12 }, { "mpPotion", 20 }, { "cook", 1 }, { "bomb", 20 } };
List<string> equip = new List<string>() { "hat12", "hat10", "shoes1", "costume20" };

Param param = new Param();
param.Add("money", money);
param.Add("level", level);

Param param2 = new Param();
param2.Add("items", items);
param2.Add("equip", equip);

var bro1 = Backend.GameData.Update("stats", new Where(), param);
var bro2 = Backend.GameData.Update("items", new Where(), param2);

Param logParam = new Param();

if(!bro1.IsSuccess())
{
logParam.Add("statsUpdateError", bro1.ToString());
}
if(!bro2.IsSuccess())
{
logParam.Add("itemsUpdateError", bro2.ToString());
}

logParam.Add("statsParam", param);
logParam.Add("itemsParam", param2);

Backend.GameLog.InsertLog("updateLog", logParam);
}