Struct LogDecorateScope
Disposable struct that adds Decorations to the logs in the scope, or to some particular log
Inherited Members
Namespace: Unity.Logging
Syntax
[BurstCompile]
public readonly struct LogDecorateScope : IDisposable
Remarks
Example:
using LogDecorateScope decorConst1 = Log.To(log).Decorate('ConstantExampleLog1', 999999);
or
using LogDecorateScope decorConstAll = Log.Decorate('ToAll', 42);
It will Dispose (unlock) m_Lock that is passed in and was created in .To(log2) The way it works internally is:
ref var logController = ref ctx.Lock.GetLogController();
ref var data = ref LogController.BeginEditDecoratePayloadHandles(ref logController, out var nBefore);
unsafe
{
fixed (FixedList4096Bytes{PayloadHandle}* ptr = data)
{
var dec = LogContextWithDecorator.From4096(ptr, scopedLock);
-- Adds decoration to(ref dec); --
}
}
var payloadHandles = LogController.EndEditDecoratePayloadHandles(ref logController, nBefore);
return new LogDecorateScope(logController.Handle, payloadHandles);
Constructors
LogDecorateScope(LogControllerScopedLock, FixedList64Bytes<PayloadHandle>)
Creates the LogDecorateScope ReleaseDecoratePayloadBufferDeferred(LoggerHandle, FixedList64Bytes<PayloadHandle>)
Declaration
public LogDecorateScope(LogControllerScopedLock lock, FixedList64Bytes<PayloadHandle> payloadHandles)
Parameters
Type | Name | Description |
---|---|---|
LogControllerScopedLock | lock | LogControllerScopedLock that is a default if global, or lock that holds some LogController |
FixedList64Bytes<PayloadHandle> | payloadHandles | Payload handles that will be deferred-released when Dispose is called. |
Remarks
Warning: the lock is disposed because it can't be held for the whole scope.
Methods
Dispose()
Payload handles will be deferred-released in this call.
Declaration
public readonly void Dispose()