Table of Contents

Class LinuxJournalLogger

Namespace
VpnHood.Core.Client.Devices.Linux
Assembly
VpnHood.Core.Client.Devices.Linux.dll

Represents the console of a systemd service, whose stdout is the journal: each line starts with its level, as <3> for an error, which the journal files it under and takes off.

public sealed class LinuxJournalLogger : ILogger
Inheritance
LinuxJournalLogger
Implements
Inherited Members

Remarks

The journal stamps each line, so its provider asks TextLogger for no time.

Properties

IsConsole

Gets a value indicating whether stdout is the journal's stream.

public static bool IsConsole { get; }

Property Value

bool

Remarks

systemd names that stream in JOURNAL_STREAM, as device:inode, and a process inherits the variable with an output of its own — a shell in a terminal a desktop's service started, say — so the stream itself is compared, as systemd asks: /proc names a socket socket:[inode].

Methods

BeginScope<TState>(TState)

Begins no scope: the journal's lines have none.

public IDisposable? BeginScope<TState>(TState state) where TState : notnull

Parameters

state TState

The scope's state.

Returns

IDisposable

null.

Type Parameters

TState

The type of the scope's state.

GetPriority(LogLevel)

Gets syslog's priority for a level, which the journal files an entry under.

public static int GetPriority(LogLevel logLevel)

Parameters

logLevel LogLevel

The level.

Returns

int

2 for critical, 3 for error, 4 for warning, 6 for information, and 7 for the rest.

IsEnabled(LogLevel)

Determines whether a level is written: every level is, as its provider filters.

public bool IsEnabled(LogLevel logLevel)

Parameters

logLevel LogLevel

The level.

Returns

bool

true.

Log<TState>(LogLevel, EventId, TState, Exception?, Func<TState, Exception?, string>)

Writes an entry to stdout as a line that starts with its syslog priority.

public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter)

Parameters

logLevel LogLevel

The entry's level.

eventId EventId

The entry's event, which the line leaves out.

state TState

The entry's state.

exception Exception

The entry's exception, or null.

formatter Func<TState, Exception, string>

The function that makes the entry's text.

Type Parameters

TState

The type of the entry's state.