save
BACKND Guidelines > 7. Implementing Game Log Functions > Step 2. Saving Game Logs
Saving Game Logs
1. Write a game log insertion method
Add content to the GameLogInsert method in BackendGameLog.cs written in Pre-arrangements.
BackendGameLog.cs
Before editing
public void GameLogInsert() {
// Adds logic of Step 2. Saving Game Logs
}
After editing
public void GameLogInsert() {
Param param = new Param();
param.Add("clearStage", 1);
param.Add("currentMoney", 100000);
Debug.Log("Attempting to insert game log.");
var bro = Backend.GameLog.InsertLog("ClearStage", param);
if(bro.IsSuccess() == false) {
Debug.LogError("An error occurred while inserting the game log. : " + bro);
return;
}
Debug.Log("Successfully inserted game log. : " + bro);
}
2. Add method call to BackendManager.cs
BackendManager, which is automatically called when the game is executed, must be used to call this method.
Add it so that the method may be called after BACKND initialization and BACKND login.
BackendManager.cs
Before editing
async void Test() {
await Task.Run(() => {
BackendLogin.Instance.CustomLogin("user1", "1234");
// Adds content of saving game logs
Debug.Log("Test complete.");
});
}
After editing
async void Test() {
await Task.Run(() => {
BackendLogin.Instance.CustomLogin("user1", "1234");
BackendGameLog.Instance.GameLogInsert(); // [Addition] Function for saving game logs
Debug.Log("Test complete.");
});
}
3. Test in Unity
After editing the script, execute Unity debugging and check the console log of Unity.
![](https://developer.thebackend.io/static/img/newconsole/en/SDKDocs/BACKND Base/BACKND Guidelines/Step7 GameLog/BACKND_GameLog_01_EN.png)
The method has been successfully called when the log displays 'Successfully inserted the game log. : statusCode : 204'.
When errors, such as statusCode : 400, 404, and 409, occur instead of the above log, you can check which errors caused the failure in InsertLog error case.
4. Check in the console
When a log showing success appears in the game log, go to BACKND Console and under BACKND Base > Log Management
, click Action Type and select the inserted action type.
![](https://developer.thebackend.io/static/img/newconsole/en/SDKDocs/BACKND Base/BACKND Guidelines/Step7 GameLog/BACKND_GameLog_02_EN.png)