Log Configuration¶
Log Initialization Configuration¶
FTUnityBridge.InitLogConfig(new LogConfig
{
sampleRate = 0.9f,
enableCustomLog = true,
enableLinkRumData = true,
});
| Field | Type | Required | Description |
|---|---|---|---|
| sampleRate | float | No | Sampling rate, value range [0,1]. 0 means no collection, 1 means full collection. Default value is 1. |
| enableLinkRumData | boolean | No | Whether to associate with RUM. |
| enableCustomLog | boolean | No | Whether to enable custom logs. |
| discardStrategy | string | No | Log discard strategy: discard discards new data (default), discardOldest discards old data. |
| logLevelFilters | array |
No | Log level filters: info, warning, error, critical, ok. |
| globalContext | object | No | Custom global parameters. |
| logCacheLimitCount | number | No | Local cache maximum log entry count limit [1000,). Default is 5000. |
Logger Log Printing¶
Currently, the log content is limited to 30 KB. Characters exceeding this limit will be truncated.
Usage¶
/// <summary>
/// Add a log.
/// </summary>
/// <param name="log">Log content.</param>
/// <param name="level">Log level: info, warning, error, critical, ok.</param>
/// <returns></returns>
public static async Task AddLog(string log, LogLevel level)
/// <summary>
/// Add a log.
/// </summary>
/// <param name="log">Log content.</param>
/// <param name="level">Log level: info, warning, error, critical, ok.</param>
/// <param name="property">Additional property parameters.</param>
/// <returns></returns>
public static async Task AddLog(string log, LogLevel level, Dictionary<string, object> property)
LogLevel¶
| Method Name | Meaning |
|---|---|
| info | Information |
| warning | Warning |
| error | Error |
| critical | Critical |
| ok | OK |