Skip to main content
Version: 6.0.0

CreateLog

public BackndReturnObject CreateLog(string logType, Param param);
public BackndReturnObject CreateLog(string logType, Param param, int expirationDays);

Parameters

ValueTypeDescription
logTypestringType used to classify logs
paramstringParam that includes the content to be recorded in logs
expirationDaysintReserved date for deletion(If expirationDays is 10, the log is deleted automatically after 10 days; default setting is 90 days)

Description

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

expirationDays

expirationDays is the grace period.(It is the same as graceDays in the existing CreateLog.) If you enter 10 for expirationDays, 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, expirationDays is set to 90(3 months).

Example

Synchronous

Param param = new Param();
param.Add("n_n", "tableName");
Backnd.GameLog.CreateLog("logType", param);

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

Asynchronous

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

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

Return cases

Success cases

When the log is created successfully
statusCode : 204

Sample code

public void CreateLogTest() {
long money = 12345678;
int level = 100;
double hp = 123;
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.Add("hp", hp);

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

var bro1 = Backnd.PlayerTable.UpdateMyLatestData("stats", param);
var bro2 = Backnd.PlayerTable.UpdateMyLatestData("items", param2);

// Log for error collection
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);

var logBro = Backnd.GameLog.CreateLog("updateLog", logParam);
Debug.Log(logBro.ToString());
}