tgstation-server 6.18.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
Static Public Member Functions | Static Public Attributes | Properties | Static Private Member Functions | Static Private Attributes | List of all members
Tgstation.Server.Host.Utils.SerilogContextHelper Class Reference

Helpers for manipulating the Serilog.Context.LogContext. More...

Collaboration diagram for Tgstation.Server.Host.Utils.SerilogContextHelper:
Collaboration graph
[legend]

Static Public Member Functions

static void AddSwarmNodeIdentifierToTemplate ()
 Adds the placeholder for the SwarmIdentifierContextProperty to the Template.
 

Static Public Attributes

const string InstanceIdContextProperty = "Instance"
 The Serilog.Context.LogContext property name for Models.Instance Api.Models.EntityId.Ids.
 
const string JobIdContextProperty = "Job"
 The Serilog.Context.LogContext property name for Models.Job Api.Models.EntityId.Ids.
 
const string RequestPathContextProperty = "Request"
 The Serilog.Context.LogContext property name for Models.User Api.Models.EntityId.Ids.
 
const string UserIdContextProperty = "User"
 The Serilog.Context.LogContext property name for Models.Instance Api.Models.EntityId.Ids.
 
const string WatchdogMonitorIterationContextProperty = "Monitor"
 The Serilog.Context.LogContext property name for the ID of the watchdog monitor iteration currently being processed.
 
const string BridgeRequestIterationContextProperty = "Bridge"
 The Serilog.Context.LogContext property name for the ID of the bridge request currently being processed.
 
const string ChatMessageIterationContextProperty = "ChatMessage"
 The Serilog.Context.LogContext property name for the ID of the chat message currently being processed.
 
const string InstanceReferenceContextProperty = "InstanceReference"
 The Serilog.Context.LogContext property name for Components.IInstanceReference.Uids.
 
const string SwarmIdentifierContextProperty = "Node"
 The Serilog.Context.LogContext property name for Api.Models.Internal.SwarmServer.Identifiers.
 

Properties

static string Template [get, private set]
 Common template used for adding our custom log context to serilog.
 

Static Private Member Functions

static SerilogContextHelper ()
 Initializes static members of the SerilogContextHelper class.
 

Static Private Attributes

const string DefaultTemplate = $"Instance:{{{InstanceIdContextProperty}}}|Job:{{{JobIdContextProperty}}}|Request:{{{RequestPathContextProperty}}}|User:{{{UserIdContextProperty}}}|Monitor:{{{WatchdogMonitorIterationContextProperty}}}|Bridge:{{{BridgeRequestIterationContextProperty}}}|Chat:{{{ChatMessageIterationContextProperty}}}|IR:{{{InstanceReferenceContextProperty}}}"
 The default value of Template.
 

Detailed Description

Helpers for manipulating the Serilog.Context.LogContext.

Definition at line 6 of file SerilogContextHelper.cs.

Constructor & Destructor Documentation

◆ SerilogContextHelper()

static Tgstation.Server.Host.Utils.SerilogContextHelper.SerilogContextHelper ( )
staticprivate

Initializes static members of the SerilogContextHelper class.

Definition at line 67 of file SerilogContextHelper.cs.

68 {
70 }
static string Template
Common template used for adding our custom log context to serilog.
const string DefaultTemplate
The default value of Template.

References Tgstation.Server.Host.Utils.SerilogContextHelper.DefaultTemplate, and Tgstation.Server.Host.Utils.SerilogContextHelper.Template.

Member Function Documentation

◆ AddSwarmNodeIdentifierToTemplate()

static void Tgstation.Server.Host.Utils.SerilogContextHelper.AddSwarmNodeIdentifierToTemplate ( )
static

Adds the placeholder for the SwarmIdentifierContextProperty to the Template.

Definition at line 75 of file SerilogContextHelper.cs.

76 {
77 Template = $"{DefaultTemplate}|Node:{{{SwarmIdentifierContextProperty}}}";
78 }

References Tgstation.Server.Host.Utils.SerilogContextHelper.Template.

Member Data Documentation

◆ BridgeRequestIterationContextProperty

const string Tgstation.Server.Host.Utils.SerilogContextHelper.BridgeRequestIterationContextProperty = "Bridge"
static

The Serilog.Context.LogContext property name for the ID of the bridge request currently being processed.

Definition at line 36 of file SerilogContextHelper.cs.

Referenced by Tgstation.Server.Host.Controllers.BridgeController.Process().

◆ ChatMessageIterationContextProperty

const string Tgstation.Server.Host.Utils.SerilogContextHelper.ChatMessageIterationContextProperty = "ChatMessage"
static

The Serilog.Context.LogContext property name for the ID of the chat message currently being processed.

Definition at line 41 of file SerilogContextHelper.cs.

Referenced by Tgstation.Server.Host.Components.Chat.ChatManager.MonitorMessages().

◆ DefaultTemplate

const string Tgstation.Server.Host.Utils.SerilogContextHelper.DefaultTemplate = $"Instance:{{{InstanceIdContextProperty}}}|Job:{{{JobIdContextProperty}}}|Request:{{{RequestPathContextProperty}}}|User:{{{UserIdContextProperty}}}|Monitor:{{{WatchdogMonitorIterationContextProperty}}}|Bridge:{{{BridgeRequestIterationContextProperty}}}|Chat:{{{ChatMessageIterationContextProperty}}}|IR:{{{InstanceReferenceContextProperty}}}"
staticprivate

The default value of Template.

Definition at line 56 of file SerilogContextHelper.cs.

Referenced by Tgstation.Server.Host.Utils.SerilogContextHelper.SerilogContextHelper().

◆ InstanceIdContextProperty

const string Tgstation.Server.Host.Utils.SerilogContextHelper.InstanceIdContextProperty = "Instance"
static

◆ InstanceReferenceContextProperty

const string Tgstation.Server.Host.Utils.SerilogContextHelper.InstanceReferenceContextProperty = "InstanceReference"
static

The Serilog.Context.LogContext property name for Components.IInstanceReference.Uids.

Definition at line 46 of file SerilogContextHelper.cs.

Referenced by Tgstation.Server.Host.Controllers.ComponentInterfacingController.WithComponentInstanceNullable().

◆ JobIdContextProperty

const string Tgstation.Server.Host.Utils.SerilogContextHelper.JobIdContextProperty = "Job"
static

The Serilog.Context.LogContext property name for Models.Job Api.Models.EntityId.Ids.

Definition at line 16 of file SerilogContextHelper.cs.

Referenced by Tgstation.Server.Host.Jobs.JobService.RunJob().

◆ RequestPathContextProperty

const string Tgstation.Server.Host.Utils.SerilogContextHelper.RequestPathContextProperty = "Request"
static

The Serilog.Context.LogContext property name for Models.User Api.Models.EntityId.Ids.

Definition at line 21 of file SerilogContextHelper.cs.

Referenced by Tgstation.Server.Host.Controllers.ApiController.HookExecuteAction(), and Tgstation.Server.Host.Controllers.SwarmController.HookExecuteAction().

◆ SwarmIdentifierContextProperty

const string Tgstation.Server.Host.Utils.SerilogContextHelper.SwarmIdentifierContextProperty = "Node"
static

The Serilog.Context.LogContext property name for Api.Models.Internal.SwarmServer.Identifiers.

Definition at line 51 of file SerilogContextHelper.cs.

Referenced by Tgstation.Server.Host.Extensions.ApplicationBuilderExtensions.UseAdditionalRequestLoggingContext().

◆ UserIdContextProperty

const string Tgstation.Server.Host.Utils.SerilogContextHelper.UserIdContextProperty = "User"
static

The Serilog.Context.LogContext property name for Models.Instance Api.Models.EntityId.Ids.

Definition at line 26 of file SerilogContextHelper.cs.

Referenced by Tgstation.Server.Host.Controllers.ApiController.HookExecuteAction().

◆ WatchdogMonitorIterationContextProperty

const string Tgstation.Server.Host.Utils.SerilogContextHelper.WatchdogMonitorIterationContextProperty = "Monitor"
static

The Serilog.Context.LogContext property name for the ID of the watchdog monitor iteration currently being processed.

Definition at line 31 of file SerilogContextHelper.cs.

Referenced by Tgstation.Server.Host.Components.Watchdog.WatchdogBase.MonitorLifetimes().

Property Documentation

◆ Template

string Tgstation.Server.Host.Utils.SerilogContextHelper.Template
staticgetprivate set

Common template used for adding our custom log context to serilog.

Should not be changed. Only mutable for the sake of identifying swarm nodes under a single test environment

Definition at line 62 of file SerilogContextHelper.cs.

62{ get; private set; }

Referenced by Tgstation.Server.Host.Utils.SerilogContextHelper.AddSwarmNodeIdentifierToTemplate(), and Tgstation.Server.Host.Utils.SerilogContextHelper.SerilogContextHelper().


The documentation for this class was generated from the following file: