Table of Contents

Class LogScanner

Namespace
Valheim.Testing.Game
Assembly
Valheim.Testing.Game.dll

Scans a whole run's logs after its processes stopped, for problems that only warn or appear long after startup: a Harmony patch whose target is gone, a global unpatch, missing members after a game update, errors while objects unload, RPCs without a handler, objects whose prefab is not registered, missing scripts and shaders a GPU cannot run; a dedicated server's own graphics errors are known too. Each known pattern is counted per log with its first occurrence and has a default severity a run may change with a written reason. BepInEx warning and error lines that match no pattern are counted as UnknownWarning and UnknownError, never ignored. Unknown errors fail by default; a run can name an exact expected header line with a written reason. Unity's Player.log has no levels; there an exception Unity printed (a line that starts with the exception's type name, outside a BepInEx warning or error record) that no known pattern names is counted as UnityException, which fails. The same Unity message may appear in both logs. Owned processes are asked to quit at teardown and killed only if they do not (StopCleanly(TimeSpan, TimeSpan)): after a clean stop the logs include what the game and its mods logged while shutting down, for example an UnpatchAll a mod calls when the game quits; after a kill they do not.

public static class LogScanner
Inheritance
object
LogScanner

Fields

UnityException

public const string UnityException = "unity-exception"

Field Value

string

UnknownError

public const string UnknownError = "unknown-error"

Field Value

string

UnknownWarning

public const string UnknownWarning = "unknown-warning"

Field Value

string

Properties

KnownGameNoise

The game's own lines on a given platform that are not a mod's problem, each measured on the game version its comment names. A run can allow a newer one from its plan without a toolkit release: a LogClassification with a new name, a Line and Warning.

public static IReadOnlyList<LogPattern> KnownGameNoise { get; }

Property Value

IReadOnlyList<LogPattern>

Names

The built-in names a classification may use: the patterns, UnityException, UnknownWarning and UnknownError. Any other name defines a pattern of the run's own (Line).

public static IReadOnlyList<string> Names { get; }

Property Value

IReadOnlyList<string>

Patterns

The known patterns and their default severities: the problems, then KnownGameNoise.

public static IReadOnlyList<LogPattern> Patterns { get; }

Property Value

IReadOnlyList<LogPattern>

Methods

CheckClassifications(IReadOnlyDictionary<string, LogClassification>?)

Refuses a classification without a written reason, a built-in pattern given a regex, and a pattern of the run's own without a line regex or a severity, or whose regex does not parse.

public static void CheckClassifications(IReadOnlyDictionary<string, LogClassification>? classifications)

Parameters

classifications IReadOnlyDictionary<string, LogClassification>

Scan(RunLog, IReadOnlyDictionary<string, LogClassification>?)

Counts every pattern in one log. A missing log has no counts; a missing required log is a Problem.

public static LogFileScan Scan(RunLog log, IReadOnlyDictionary<string, LogClassification>? classifications = null)

Parameters

log RunLog
classifications IReadOnlyDictionary<string, LogClassification>

Returns

LogFileScan