Skip to main content
Version: 5.11.4

InsertLogV2

public BackendReturnObject InsertLogV2(string logType, Param param);
public BackendReturnObject InsertLogV2(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 InsertLog.) 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");
Backend.GameLog.InsertLogV2("logType", param);

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

Asynchronous

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

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

SendQueue

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

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

Return cases

Success cases

When the log is created successfully
statusCode : 204

Sample code

public void InsertLogV2Test() {
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 = Backend.GameData.Update("stats", new Where(), param);
var bro2 = Backend.GameData.Update("items", new Where(), 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 = Backend.GameLog.InsertLogV2("updateLog", logParam);
Debug.Log(logBro.ToString());
}