From 6ea6803456465d45e586313d2015bfc966288ad6 Mon Sep 17 00:00:00 2001 From: Dev Date: Wed, 29 May 2024 10:09:10 +0100 Subject: [PATCH] Updated various mods to use PrimaryLogger instead of WinstonLogger --- TypeScript/11BundleLoadingSample/src/mod.ts | 2 +- TypeScript/13AddTrader/src/mod.ts | 2 +- TypeScript/14AfterDBLoadHook/src/mod.ts | 6 +++--- TypeScript/16ImporterUtil/src/mod.ts | 2 +- TypeScript/17AsyncImporterWithDependency1/src/mod.ts | 2 +- TypeScript/17AsyncImporterWithDependency2/src/mod.ts | 2 +- TypeScript/19UseExternalLibraries/src/mod.ts | 2 +- TypeScript/4.1UseACustomJson5OrJsonCConfigFile/src/mod.ts | 2 +- TypeScript/4UseACustomConfigFile/src/mod.ts | 2 +- TypeScript/5ReplaceMethod/src/mod.ts | 2 +- TypeScript/6ReferenceAnotherClass/src/mod.ts | 2 +- TypeScript/7OnLoadHook/src/mod.ts | 2 +- TypeScript/8OnUpdateHook/src/mod.ts | 2 +- TypeScript/9RouterHooks/src/mod.ts | 2 +- 14 files changed, 16 insertions(+), 16 deletions(-) diff --git a/TypeScript/11BundleLoadingSample/src/mod.ts b/TypeScript/11BundleLoadingSample/src/mod.ts index eb5ed53..cabeea2 100644 --- a/TypeScript/11BundleLoadingSample/src/mod.ts +++ b/TypeScript/11BundleLoadingSample/src/mod.ts @@ -8,7 +8,7 @@ class Mod implements IPostSptLoadMod public postSptLoad(container: DependencyContainer): void { // get the logger from the server container - const logger = container.resolve("WinstonLogger"); + const logger = container.resolve("PrimaryLogger"); logger.info("Loading: Bundle Loading Sample"); } diff --git a/TypeScript/13AddTrader/src/mod.ts b/TypeScript/13AddTrader/src/mod.ts index 109d13b..11695de 100644 --- a/TypeScript/13AddTrader/src/mod.ts +++ b/TypeScript/13AddTrader/src/mod.ts @@ -40,7 +40,7 @@ class SampleTrader implements IPreSptLoadMod, IPostDBLoadMod public preSptLoad(container: DependencyContainer): void { // Get a logger - this.logger = container.resolve("WinstonLogger"); + this.logger = container.resolve("PrimaryLogger"); this.logger.debug(`[${this.mod}] preSpt Loading... `); // Get SPT code/data we need later diff --git a/TypeScript/14AfterDBLoadHook/src/mod.ts b/TypeScript/14AfterDBLoadHook/src/mod.ts index 4db8b04..c4deac0 100644 --- a/TypeScript/14AfterDBLoadHook/src/mod.ts +++ b/TypeScript/14AfterDBLoadHook/src/mod.ts @@ -14,7 +14,7 @@ class Mod implements IPreSptLoadMod, IPostSptLoadMod, IPostDBLoadMod public preSptLoad(container: DependencyContainer): void { // Database will be empty in here const databaseServer = container.resolve("DatabaseServer"); - const logger = container.resolve("WinstonLogger"); + const logger = container.resolve("PrimaryLogger"); logger.logWithColor(`Database item table state: ${databaseServer.getTables().templates} (<<< should be undefined)`, LogTextColor.RED, LogBackgroundColor.YELLOW); } @@ -22,7 +22,7 @@ class Mod implements IPreSptLoadMod, IPostSptLoadMod, IPostDBLoadMod // Database will be loaded, this is the fresh state of the DB so NOTHING from the SPT // logic has modified anything yet. This is the DB loaded straight from the JSON files const databaseServer = container.resolve("DatabaseServer"); - const logger = container.resolve("WinstonLogger"); + const logger = container.resolve("PrimaryLogger"); logger.logWithColor(`Database item size: ${Object.entries(databaseServer.getTables().templates.items).length}`, LogTextColor.RED, LogBackgroundColor.YELLOW); // lets do a quick modification and see how this reflect later on, on the postSptLoad() @@ -38,7 +38,7 @@ class Mod implements IPreSptLoadMod, IPostSptLoadMod, IPostDBLoadMod // The modification we made above would have been processed by now by SPT, so any values we changed had // already been passed through the initial lifecycles (OnLoad) of SPT. const databaseServer = container.resolve("DatabaseServer"); - const logger = container.resolve("WinstonLogger"); + const logger = container.resolve("PrimaryLogger"); // find the nvgs item again by its Id const nvgs = databaseServer.getTables().templates.items["5c0558060db834001b735271"]; diff --git a/TypeScript/16ImporterUtil/src/mod.ts b/TypeScript/16ImporterUtil/src/mod.ts index f53b02c..cb63d54 100644 --- a/TypeScript/16ImporterUtil/src/mod.ts +++ b/TypeScript/16ImporterUtil/src/mod.ts @@ -9,7 +9,7 @@ import { ConfigsModelBase } from "./model/ConfigsModel"; class Mod implements IPreSptLoadMod { public preSptLoad(container: DependencyContainer): void { // get logger - const logger = container.resolve("WinstonLogger"); + const logger = container.resolve("PrimaryLogger"); const importerUtil = container.resolve("ImporterUtil"); const modImporter = container.resolve("PreSptModLoader"); diff --git a/TypeScript/17AsyncImporterWithDependency1/src/mod.ts b/TypeScript/17AsyncImporterWithDependency1/src/mod.ts index 4137858..a7e9cd9 100644 --- a/TypeScript/17AsyncImporterWithDependency1/src/mod.ts +++ b/TypeScript/17AsyncImporterWithDependency1/src/mod.ts @@ -9,7 +9,7 @@ import { ConfigsModelBase } from "./model/ConfigsModel"; class Mod implements IPreSptLoadModAsync { public async preSptLoadAsync(container: DependencyContainer): Promise { // get logger - const logger = container.resolve("WinstonLogger"); + const logger = container.resolve("PrimaryLogger"); const importerUtil = container.resolve("ImporterUtil"); const modImporter = container.resolve("PreSptModLoader"); diff --git a/TypeScript/17AsyncImporterWithDependency2/src/mod.ts b/TypeScript/17AsyncImporterWithDependency2/src/mod.ts index 36808e8..8c36af0 100644 --- a/TypeScript/17AsyncImporterWithDependency2/src/mod.ts +++ b/TypeScript/17AsyncImporterWithDependency2/src/mod.ts @@ -9,7 +9,7 @@ import { ConfigsModelBase } from "./model/ConfigsModel"; class Mod implements IPreSptLoadModAsync { public async preSptLoadAsync(container: DependencyContainer): Promise { // get logger - const logger = container.resolve("WinstonLogger"); + const logger = container.resolve("PrimaryLogger"); const importerUtil = container.resolve("ImporterUtil"); const modImporter = container.resolve("PreSptModLoader"); diff --git a/TypeScript/19UseExternalLibraries/src/mod.ts b/TypeScript/19UseExternalLibraries/src/mod.ts index efe5e5e..ec798a5 100644 --- a/TypeScript/19UseExternalLibraries/src/mod.ts +++ b/TypeScript/19UseExternalLibraries/src/mod.ts @@ -13,7 +13,7 @@ import ora from "ora-classic"; class Mod implements IPreSptLoadMod, IPostSptLoadMod { public preSptLoad(container: DependencyContainer): void { const vfs = container.resolve("VFS"); - const logger = container.resolve("WinstonLogger"); + const logger = container.resolve("PrimaryLogger"); const parsedJsonC = jsonc.parse(vfs.readFile(path.resolve(__dirname, "../test.jsonc"))); diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/src/mod.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/src/mod.ts index 59cc800..ea521fd 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/src/mod.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/src/mod.ts @@ -12,7 +12,7 @@ class Mod implements IPostSptLoadMod { public postSptLoad(container: DependencyContainer): void { // get logger - const logger = container.resolve("WinstonLogger"); + const logger = container.resolve("PrimaryLogger"); // Get VFS to read in configs const vfs = container.resolve("VFS"); diff --git a/TypeScript/4UseACustomConfigFile/src/mod.ts b/TypeScript/4UseACustomConfigFile/src/mod.ts index 8fba649..3b555ed 100644 --- a/TypeScript/4UseACustomConfigFile/src/mod.ts +++ b/TypeScript/4UseACustomConfigFile/src/mod.ts @@ -9,7 +9,7 @@ class Mod implements IPostSptLoadMod public postSptLoad(container: DependencyContainer): void { // get logger - const logger = container.resolve("WinstonLogger"); + const logger = container.resolve("PrimaryLogger"); // log the 'myProperty' value to the console logger.info(`here is the value from my config: ${this.modConfig.myProperty}`); diff --git a/TypeScript/5ReplaceMethod/src/mod.ts b/TypeScript/5ReplaceMethod/src/mod.ts index 61e48a7..5331e62 100644 --- a/TypeScript/5ReplaceMethod/src/mod.ts +++ b/TypeScript/5ReplaceMethod/src/mod.ts @@ -54,7 +54,7 @@ class Mod implements IPreSptLoadMod // This is now extra stuff we want to add // We resolve 2 more dependencies: The logger and the DatabaseServer - const logger = Mod.container.resolve("WinstonLogger"); + const logger = Mod.container.resolve("PrimaryLogger"); const dbServer = Mod.container.resolve("DatabaseServer"); // As an example Im counting the amount of loaded items on the DB diff --git a/TypeScript/6ReferenceAnotherClass/src/mod.ts b/TypeScript/6ReferenceAnotherClass/src/mod.ts index 81a37fa..0a6f127 100644 --- a/TypeScript/6ReferenceAnotherClass/src/mod.ts +++ b/TypeScript/6ReferenceAnotherClass/src/mod.ts @@ -9,7 +9,7 @@ class Mod implements IPostSptLoadMod public postSptLoad(container: DependencyContainer): void { // get logger - const logger = container.resolve("WinstonLogger"); + const logger = container.resolve("PrimaryLogger"); // Make a new instance of the 'MoreCode' class const moreCode = new MoreCode(); diff --git a/TypeScript/7OnLoadHook/src/mod.ts b/TypeScript/7OnLoadHook/src/mod.ts index 831aec0..89bf6e5 100644 --- a/TypeScript/7OnLoadHook/src/mod.ts +++ b/TypeScript/7OnLoadHook/src/mod.ts @@ -8,7 +8,7 @@ class Mod implements IPreSptLoadMod { public preSptLoad(container: DependencyContainer): void { - const logger = container.resolve("WinstonLogger"); + const logger = container.resolve("PrimaryLogger"); const onLoadModService = container.resolve("OnLoadModService"); onLoadModService.registerOnLoad( "MyCustomMod", // route key diff --git a/TypeScript/8OnUpdateHook/src/mod.ts b/TypeScript/8OnUpdateHook/src/mod.ts index c36134b..09ea802 100644 --- a/TypeScript/8OnUpdateHook/src/mod.ts +++ b/TypeScript/8OnUpdateHook/src/mod.ts @@ -7,7 +7,7 @@ import { OnUpdateModService } from "@spt/services/mod/onUpdate/OnUpdateModServic class Mod implements IPreSptLoadMod { public preSptLoad(container: DependencyContainer): void { - const logger = container.resolve("WinstonLogger"); + const logger = container.resolve("PrimaryLogger"); const onUpdateModService = container.resolve("OnUpdateModService"); onUpdateModService.registerOnUpdate( diff --git a/TypeScript/9RouterHooks/src/mod.ts b/TypeScript/9RouterHooks/src/mod.ts index 51e7122..3f4431c 100644 --- a/TypeScript/9RouterHooks/src/mod.ts +++ b/TypeScript/9RouterHooks/src/mod.ts @@ -8,7 +8,7 @@ import type {StaticRouterModService} from "@spt/services/mod/staticRouter/Static class Mod implements IPreSptLoadMod { public preSptLoad(container: DependencyContainer): void { - const logger = container.resolve("WinstonLogger"); + const logger = container.resolve("PrimaryLogger"); const dynamicRouterModService = container.resolve("DynamicRouterModService"); const staticRouterModService = container.resolve("StaticRouterModService");