Vixen
02b45cc4
csharp
public sealed class ConsoleSink

The log on the terminal: one line per record, colourised by level, with the timestamp, the level and the category in fixed columns.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Development and server builds, not shipping ones. A shipped game has no terminal to write to and pays for every string it formats; a dedicated server has nothing else, which is why doc 17's variant table lists console for Development and full logging for Server and gives Release the ring and the crash reporter only.

Aligned because a log is read by eye and by grep, and both want the level in the same place on every line. The category column truncates from the front — a category that does not fit keeps its tail, since …Vulkan.Device identifies the writer and Vixen.Graphics.V… does not.

Colour is off when the output is redirected, when NO_COLOR is set, and when TERM is dumb — a build log full of escape sequences is worse than a build log without colour, and NO_COLOR is the one convention every tool agrees on.

Errors go to standard error, because that is the stream a container's log driver and a CI runner both treat as the one worth alerting on.

Fields and properties (5)

  • public const int DefaultCategoryWidth

    How wide the category column is when nothing else is asked for.

  • public bool UseColour

    Whether lines carry ANSI colour. Detected from the environment by default.

  • public bool ShowTimestamps

    Whether lines start with a timestamp.

  • public LogLevel StandardErrorThreshold

    The level from which lines go to standard error rather than standard output.

  • public int CategoryWidth

    How wide the category column is.

Methods (2)

  • public ConsoleSink(LogLevel minimumLevel = Information, LogFilter? filter = null)

    Creates a sink writing to the process's console.

  • protected override void Write(LogRecord record)

    Writes one record wherever this sink writes.

Used by (2)

  • AppBuilderVixen.App.Hosting
  • SinkTestsVixen.Core.Diagnostics.Tests