提交 | 用户 | 时间
|
8871a7
|
1 |
// Fill out your copyright notice in the Description page of Project Settings. |
L |
2 |
|
|
3 |
|
|
4 |
#include "Define/TapTraceEvent.h" |
|
5 |
|
|
6 |
#include "Taptap.h" |
|
7 |
|
|
8 |
UTapTraceEvent::UTapTraceEvent() |
|
9 |
{ |
|
10 |
JsonObject = MakeShareable(new FJsonObject()); |
|
11 |
} |
|
12 |
|
|
13 |
void UTapTraceEvent::PutString(FString name, FString value) |
|
14 |
{ |
|
15 |
JsonObject->SetStringField(name,value); |
|
16 |
} |
|
17 |
|
|
18 |
void UTapTraceEvent::PutInt(FString name, int32 value) |
|
19 |
{ |
|
20 |
JsonObject->SetNumberField(name,value); |
|
21 |
} |
|
22 |
|
|
23 |
void UTapTraceEvent::PutFlot(FString name, float value) |
|
24 |
{ |
|
25 |
JsonObject->SetNumberField(name,value); |
|
26 |
} |
|
27 |
|
|
28 |
FString UTapTraceEvent::Build() |
|
29 |
{ |
|
30 |
FString content; |
|
31 |
const TSharedRef<TJsonWriter<TCHAR>> write = TJsonWriterFactory<TCHAR>::Create(&content); |
|
32 |
if (!FJsonSerializer::Serialize(JsonObject.ToSharedRef(),write)) |
|
33 |
{ |
|
34 |
TAPLOG_E(TEXT("BuildTapTrackEvent时出错,无法序列化")) |
|
35 |
return FString(); |
|
36 |
} |
|
37 |
TAPLOG_D(TEXT("buildTraceEvent成功:%s"),*content) |
|
38 |
return content; |
|
39 |
} |