GS2-Log SDK for Game Engine API Reference
Specifications of models and API references for GS2-Log SDK for Game Engine
Model
EzInGameLog
In-game Log
A custom log entry sent from the game client or server-side scripts. Unlike access logs which are automatically generated by GS2 API calls, in-game logs are explicitly sent by game developers to record game-specific events such as player actions, game state changes, or business metrics.
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| timestamp | long | ✓ | Timestamp The date and time when the in-game log was sent. | |||
| userId | string | ~ 128 chars | User ID | |||
| tags | List<EzInGameLogTag> | [] | 0 ~ 20 items | Tags Key-value pairs attached to the log entry for filtering and categorization. Tags enable efficient searching and aggregation of in-game logs (e.g., event type, stage ID, item category). | ||
| payload | string | ✓ | ~ 10485760 chars | Payload The custom log data in JSON format. Can contain any game-specific information such as player actions, game state, or business metrics. Maximum 10MB. |
EzInGameLogTag
In-game Log Tag
A key-value pair used to annotate in-game log entries for filtering and categorization. Each tag key must be unique within a single log entry.
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| key | string | ✓ | ~ 64 chars | Tag Key The key name for this tag. Used as the filter criterion when searching in-game logs. | ||
| value | string | ✓ | ~ 128 chars | Tag Value The value for this tag. Combined with the key, enables filtering logs by specific criteria (e.g., key=“stageId”, value=“stage-001”). |
Methods
sendInGameLog
Send in-game logs
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| tags | List<EzInGameLogTag> | [] | 0 ~ 20 items | Tags Key-value pairs attached to the log entry for filtering and categorization. Tags enable efficient searching and aggregation of in-game logs (e.g., event type, stage ID, item category). | ||
| payload | string | ✓ | ~ 10485760 chars | Payload The custom log data in JSON format. Can contain any game-specific information such as player actions, game state, or business metrics. Maximum 10MB. | ||
| gameSession | GameSession | GameSession |
Result
| Type | Description | |
|---|---|---|
| item | EzInGameLog | In-game log |
Implementation Example
var domain = gs2.Log.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var result = await domain.SendInGameLogAsync(
payload: "{\"category\": \"use-item\", \"count\": 1, \"itemId\": \"item-0001\"}",
tags: new List<Gs2.Unity.Gs2Log.Model.EzInGameLogTag> {
new Gs2.Unity.Gs2Log.Model.EzInGameLogTag() {
Key = "tag1",
Value = "value1",
},
new Gs2.Unity.Gs2Log.Model.EzInGameLogTag() {
Key = "tag2",
Value = "value2",
},
}
);
var item = await result.ModelAsync(); var domain = gs2.Log.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var future = domain.SendInGameLogFuture(
payload: "{\"category\": \"use-item\", \"count\": 1, \"itemId\": \"item-0001\"}",
tags: new List<Gs2.Unity.Gs2Log.Model.EzInGameLogTag> {
new Gs2.Unity.Gs2Log.Model.EzInGameLogTag() {
Key = "tag1",
Value = "value1",
},
new Gs2.Unity.Gs2Log.Model.EzInGameLogTag() {
Key = "tag2",
Value = "value2",
},
}
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
var future2 = future.Result.ModelFuture();
yield return future2;
if (future2.Error != null)
{
onError.Invoke(future2.Error, null);
yield break;
}
var result = future2.Result; const auto Domain = Gs2->Log->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
);
const auto Future = Domain->SendInGameLog(
"{\"category\": \"use-item\", \"count\": 1, \"itemId\": \"item-0001\"}", // payload
[]
{
auto v = MakeShared<TArray<TSharedPtr<Gs2::UE5::Log::Model::FEzInGameLogTag>>>();
v->Add(
MakeShared<Gs2::UE5::Log::Model::FEzInGameLogTag>()
->WithKey(TOptional<FString>("tag1"))
->WithValue(TOptional<FString>("value1"))
);
v->Add(
MakeShared<Gs2::UE5::Log::Model::FEzInGameLogTag>()
->WithKey(TOptional<FString>("tag2"))
->WithValue(TOptional<FString>("value2"))
);
return v;
}() // tags
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
// obtain changed values / result values
const auto Future2 = Future->GetTask().Result()->Model();
Future2->StartSynchronousTask();
if (Future2->GetTask().IsError())
{
return Future2->GetTask().Error();
}
const auto Result = Future2->GetTask().Result();