Compare commits
3 Commits
7365434f2b
...
c4889d67b6
Author | SHA1 | Date | |
---|---|---|---|
c4889d67b6 | |||
b84fa3da0b | |||
750e7860ec |
|
@ -10,6 +10,8 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" />
|
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.0-preview.6.24327.7" />
|
||||||
|
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.9.0" />
|
||||||
<PackageReference Include="YamlDotNet" Version="15.1.6" />
|
<PackageReference Include="YamlDotNet" Version="15.1.6" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -3,6 +3,9 @@ using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using ColdMint.scripts.utils;
|
using ColdMint.scripts.utils;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using OpenTelemetry.Exporter;
|
||||||
|
using OpenTelemetry.Logs;
|
||||||
|
|
||||||
namespace ColdMint.scripts.debug;
|
namespace ColdMint.scripts.debug;
|
||||||
|
|
||||||
|
@ -27,19 +30,19 @@ public static class LogCat
|
||||||
/// <para>阵营管理器</para>
|
/// <para>阵营管理器</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string CampManager = "CampManager";
|
public const string CampManager = "CampManager";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <para>State context</para>
|
/// <para>State context</para>
|
||||||
/// <para>状态上下文</para>
|
/// <para>状态上下文</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string StateContext = "StateContext";
|
public const string StateContext = "StateContext";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <para>StateMachineTemplate</para>
|
/// <para>StateMachineTemplate</para>
|
||||||
/// <para>状态机模板</para>
|
/// <para>状态机模板</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string StateMachineTemplate = "StateMachineTemplate";
|
public const string StateMachineTemplate = "StateMachineTemplate";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <para>Pursuit enemy processor</para>
|
/// <para>Pursuit enemy processor</para>
|
||||||
/// <para>追击敌人处理器</para>
|
/// <para>追击敌人处理器</para>
|
||||||
|
@ -103,6 +106,25 @@ public static class LogCat
|
||||||
private static HashSet<string> DisabledLogLabels { get; } = [];
|
private static HashSet<string> DisabledLogLabels { get; } = [];
|
||||||
|
|
||||||
|
|
||||||
|
public static void Init()
|
||||||
|
{
|
||||||
|
var loggerFactory = LoggerFactory.Create(builder =>
|
||||||
|
{
|
||||||
|
builder.AddOpenTelemetry(options => { options.AddOtlpExporter(OtlpExporterOptions); });
|
||||||
|
});
|
||||||
|
var logger = loggerFactory.CreateLogger("323");
|
||||||
|
logger.Log(LogLevel.Debug, "你好");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void OtlpExporterOptions(OtlpExporterOptions options)
|
||||||
|
{
|
||||||
|
options.Protocol = OtlpExportProtocol.HttpProtobuf;
|
||||||
|
options.Endpoint = new Uri("http://test.coldmint.top/api/default/traces");
|
||||||
|
options.Headers =
|
||||||
|
"Authorization=Basic cm9vdEBleGFtcGxlLmNvbTp5V0kwVzZYcWhteTBzQml3,organization=default,stream-name=default";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <para>Disable log Label</para>
|
/// <para>Disable log Label</para>
|
||||||
/// <para>禁用某个日志标签</para>
|
/// <para>禁用某个日志标签</para>
|
||||||
|
|
|
@ -33,6 +33,7 @@ public partial class MainMenuLoader : UiLoaderTemplate
|
||||||
|
|
||||||
public override void InitializeData()
|
public override void InitializeData()
|
||||||
{
|
{
|
||||||
|
LogCat.Init();
|
||||||
if (Config.IsDebug())
|
if (Config.IsDebug())
|
||||||
{
|
{
|
||||||
//Set the minimum log level to Info in debug mode.(Print all logs)
|
//Set the minimum log level to Info in debug mode.(Print all logs)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user