Open HaydenReeve opened 1 month ago
Well, this will happen with any sink which uses a background thread to run. If this happens with this library I don't think I can do anythig. My advice would be to not use the ForContext
method with loggers that can run on the background thread
Yeah, I wasn't suggesting it needs to be handled, simply that it might be worth a warning on the call. Something like a /// <remarks>
letting you know that it's only safe for main thread sinks. Caught me off guard the first time it happened, but once I realised what was going on it made sense.
Otherwise, it works with no issues.
When writing to other sinks, the following error occurs when attempting to use a
.ForContext(this)
call on a Monobehaviour:I didn't find any documentation about this limitation, so it may be worth putting some XML documentation within the context call.
The resolution is to log to the sub logger with this specific context, but it does get a bit arbitrary when you dig into it. One of the main advantages to using Serilog over Unity.Test structured logging is the more general sink support.