Updated various mods to use PrimaryLogger instead of WinstonLogger

This commit is contained in:
Dev 2024-05-29 10:09:10 +01:00
parent 77f4691c8d
commit 6ea6803456
14 changed files with 16 additions and 16 deletions

View File

@ -8,7 +8,7 @@ class Mod implements IPostSptLoadMod
public postSptLoad(container: DependencyContainer): void
{
// get the logger from the server container
const logger = container.resolve<ILogger>("WinstonLogger");
const logger = container.resolve<ILogger>("PrimaryLogger");
logger.info("Loading: Bundle Loading Sample");
}

View File

@ -40,7 +40,7 @@ class SampleTrader implements IPreSptLoadMod, IPostDBLoadMod
public preSptLoad(container: DependencyContainer): void
{
// Get a logger
this.logger = container.resolve<ILogger>("WinstonLogger");
this.logger = container.resolve<ILogger>("PrimaryLogger");
this.logger.debug(`[${this.mod}] preSpt Loading... `);
// Get SPT code/data we need later

View File

@ -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>("DatabaseServer");
const logger = container.resolve<ILogger>("WinstonLogger");
const logger = container.resolve<ILogger>("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>("DatabaseServer");
const logger = container.resolve<ILogger>("WinstonLogger");
const logger = container.resolve<ILogger>("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>("DatabaseServer");
const logger = container.resolve<ILogger>("WinstonLogger");
const logger = container.resolve<ILogger>("PrimaryLogger");
// find the nvgs item again by its Id
const nvgs = databaseServer.getTables().templates.items["5c0558060db834001b735271"];

View File

@ -9,7 +9,7 @@ import { ConfigsModelBase } from "./model/ConfigsModel";
class Mod implements IPreSptLoadMod {
public preSptLoad(container: DependencyContainer): void {
// get logger
const logger = container.resolve<ILogger>("WinstonLogger");
const logger = container.resolve<ILogger>("PrimaryLogger");
const importerUtil = container.resolve<ImporterUtil>("ImporterUtil");
const modImporter = container.resolve<PreSptModLoader>("PreSptModLoader");

View File

@ -9,7 +9,7 @@ import { ConfigsModelBase } from "./model/ConfigsModel";
class Mod implements IPreSptLoadModAsync {
public async preSptLoadAsync(container: DependencyContainer): Promise<void> {
// get logger
const logger = container.resolve<ILogger>("WinstonLogger");
const logger = container.resolve<ILogger>("PrimaryLogger");
const importerUtil = container.resolve<ImporterUtil>("ImporterUtil");
const modImporter = container.resolve<PreSptModLoader>("PreSptModLoader");

View File

@ -9,7 +9,7 @@ import { ConfigsModelBase } from "./model/ConfigsModel";
class Mod implements IPreSptLoadModAsync {
public async preSptLoadAsync(container: DependencyContainer): Promise<void> {
// get logger
const logger = container.resolve<ILogger>("WinstonLogger");
const logger = container.resolve<ILogger>("PrimaryLogger");
const importerUtil = container.resolve<ImporterUtil>("ImporterUtil");
const modImporter = container.resolve<PreSptModLoader>("PreSptModLoader");

View File

@ -13,7 +13,7 @@ import ora from "ora-classic";
class Mod implements IPreSptLoadMod, IPostSptLoadMod {
public preSptLoad(container: DependencyContainer): void {
const vfs = container.resolve<VFS>("VFS");
const logger = container.resolve<ILogger>("WinstonLogger");
const logger = container.resolve<ILogger>("PrimaryLogger");
const parsedJsonC = jsonc.parse(vfs.readFile(path.resolve(__dirname, "../test.jsonc")));

View File

@ -12,7 +12,7 @@ class Mod implements IPostSptLoadMod
{
public postSptLoad(container: DependencyContainer): void {
// get logger
const logger = container.resolve<ILogger>("WinstonLogger");
const logger = container.resolve<ILogger>("PrimaryLogger");
// Get VFS to read in configs
const vfs = container.resolve<VFS>("VFS");

View File

@ -9,7 +9,7 @@ class Mod implements IPostSptLoadMod
public postSptLoad(container: DependencyContainer): void {
// get logger
const logger = container.resolve<ILogger>("WinstonLogger");
const logger = container.resolve<ILogger>("PrimaryLogger");
// log the 'myProperty' value to the console
logger.info(`here is the value from my config: ${this.modConfig.myProperty}`);

View File

@ -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<ILogger>("WinstonLogger");
const logger = Mod.container.resolve<ILogger>("PrimaryLogger");
const dbServer = Mod.container.resolve<DatabaseServer>("DatabaseServer");
// As an example Im counting the amount of loaded items on the DB

View File

@ -9,7 +9,7 @@ class Mod implements IPostSptLoadMod
public postSptLoad(container: DependencyContainer): void
{
// get logger
const logger = container.resolve<ILogger>("WinstonLogger");
const logger = container.resolve<ILogger>("PrimaryLogger");
// Make a new instance of the 'MoreCode' class
const moreCode = new MoreCode();

View File

@ -8,7 +8,7 @@ class Mod implements IPreSptLoadMod
{
public preSptLoad(container: DependencyContainer): void
{
const logger = container.resolve<ILogger>("WinstonLogger");
const logger = container.resolve<ILogger>("PrimaryLogger");
const onLoadModService = container.resolve<OnLoadModService>("OnLoadModService");
onLoadModService.registerOnLoad(
"MyCustomMod", // route key

View File

@ -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<ILogger>("WinstonLogger");
const logger = container.resolve<ILogger>("PrimaryLogger");
const onUpdateModService = container.resolve<OnUpdateModService>("OnUpdateModService");
onUpdateModService.registerOnUpdate(

View File

@ -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<ILogger>("WinstonLogger");
const logger = container.resolve<ILogger>("PrimaryLogger");
const dynamicRouterModService = container.resolve<DynamicRouterModService>("DynamicRouterModService");
const staticRouterModService = container.resolve<StaticRouterModService>("StaticRouterModService");