mirror of
https://github.com/DaanVandenBosch/phantasmal-world.git
synced 2025-04-05 15:28:29 +08:00
Reverted accidental renaming of Logger to Logging.
This commit is contained in:
parent
bbfc4403ff
commit
6d5aca2914
@ -1,4 +1,4 @@
|
|||||||
import { Logging } from "./logging";
|
import { Logger } from "./logging";
|
||||||
import { Severity } from "./Severity";
|
import { Severity } from "./Severity";
|
||||||
|
|
||||||
export type Result<T> = Success<T> | Failure;
|
export type Result<T> = Success<T> | Failure;
|
||||||
@ -60,7 +60,7 @@ export function unwrap<T>(result: Result<T>): T {
|
|||||||
export class ResultBuilder<T> {
|
export class ResultBuilder<T> {
|
||||||
private readonly problems: Problem[] = [];
|
private readonly problems: Problem[] = [];
|
||||||
|
|
||||||
constructor(private readonly logger: Logging) {}
|
constructor(private readonly logger: Logger) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a problem to the problems array and log it with {@link logger}.
|
* Add a problem to the problems array and log it with {@link logger}.
|
||||||
|
@ -5,7 +5,7 @@ export type LogEntry = {
|
|||||||
readonly time: Date;
|
readonly time: Date;
|
||||||
readonly message: string;
|
readonly message: string;
|
||||||
readonly severity: Severity;
|
readonly severity: Severity;
|
||||||
readonly logger: Logging;
|
readonly logger: Logger;
|
||||||
readonly cause?: any;
|
readonly cause?: any;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ function time_part_to_string(value: number, n: number): string {
|
|||||||
return value.toString().padStart(n, "0");
|
return value.toString().padStart(n, "0");
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Logging {
|
export class Logger {
|
||||||
private _severity?: Severity;
|
private _severity?: Severity;
|
||||||
|
|
||||||
get severity(): Severity {
|
get severity(): Severity {
|
||||||
@ -109,18 +109,18 @@ export class Logging {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class LogManager {
|
export class LogManager {
|
||||||
private static readonly loggers = new Map<string, Logging>();
|
private static readonly loggers = new Map<string, Logger>();
|
||||||
|
|
||||||
static default_severity: Severity = severity_from_string(process.env["LOG_LEVEL"] ?? "Info");
|
static default_severity: Severity = severity_from_string(process.env["LOG_LEVEL"] ?? "Info");
|
||||||
static default_handler: LogHandler = default_log_handler;
|
static default_handler: LogHandler = default_log_handler;
|
||||||
|
|
||||||
static get(name: string): Logging {
|
static get(name: string): Logger {
|
||||||
name = basename(name);
|
name = basename(name);
|
||||||
|
|
||||||
let logger = this.loggers.get(name);
|
let logger = this.loggers.get(name);
|
||||||
|
|
||||||
if (!logger) {
|
if (!logger) {
|
||||||
logger = new Logging(name);
|
logger = new Logger(name);
|
||||||
this.loggers.set(name, logger);
|
this.loggers.set(name, logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ import { QuestObjectModel } from "./model/QuestObjectModel";
|
|||||||
import { AreaStore } from "./stores/AreaStore";
|
import { AreaStore } from "./stores/AreaStore";
|
||||||
import { InstructionPointer } from "./scripting/vm/InstructionPointer";
|
import { InstructionPointer } from "./scripting/vm/InstructionPointer";
|
||||||
import { clone_segment } from "../core/data_formats/asm/instructions";
|
import { clone_segment } from "../core/data_formats/asm/instructions";
|
||||||
import { Logging } from "../core/logging";
|
import { Logger } from "../core/logging";
|
||||||
import { LogStore } from "./stores/LogStore";
|
import { LogStore } from "./stores/LogStore";
|
||||||
import { Severity } from "../core/Severity";
|
import { Severity } from "../core/Severity";
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ export type GameState = Readonly<GameStateInternal>;
|
|||||||
* delegates to {@link Debugger}.
|
* delegates to {@link Debugger}.
|
||||||
*/
|
*/
|
||||||
export class QuestRunner {
|
export class QuestRunner {
|
||||||
private logger: Logging;
|
private logger: Logger;
|
||||||
private animation_frame?: number;
|
private animation_frame?: number;
|
||||||
private startup = true;
|
private startup = true;
|
||||||
private readonly _state: WritableProperty<QuestRunnerState> = property(
|
private readonly _state: WritableProperty<QuestRunnerState> = property(
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { ListProperty } from "../../core/observable/property/list/ListProperty";
|
import { ListProperty } from "../../core/observable/property/list/ListProperty";
|
||||||
import { Property } from "../../core/observable/property/Property";
|
import { Property } from "../../core/observable/property/Property";
|
||||||
import { list_property, property } from "../../core/observable";
|
import { list_property, property } from "../../core/observable";
|
||||||
import { LogEntry, Logging, LogHandler, LogManager } from "../../core/logging";
|
import { LogEntry, Logger, LogHandler, LogManager } from "../../core/logging";
|
||||||
import { Severity } from "../../core/Severity";
|
import { Severity } from "../../core/Severity";
|
||||||
import { Store } from "../../core/stores/Store";
|
import { Store } from "../../core/stores/Store";
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ export class LogStore extends Store {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get_logger(name: string): Logging {
|
get_logger(name: string): Logger {
|
||||||
const logger = LogManager.get(name);
|
const logger = LogManager.get(name);
|
||||||
logger.handler = this.handler;
|
logger.handler = this.handler;
|
||||||
return logger;
|
return logger;
|
||||||
|
Loading…
Reference in New Issue
Block a user