Updated various mods to use PrimaryLogger instead of WinstonLogger
This commit is contained in:
parent
77f4691c8d
commit
6ea6803456
@ -8,7 +8,7 @@ class Mod implements IPostSptLoadMod
|
|||||||
public postSptLoad(container: DependencyContainer): void
|
public postSptLoad(container: DependencyContainer): void
|
||||||
{
|
{
|
||||||
// get the logger from the server container
|
// 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");
|
logger.info("Loading: Bundle Loading Sample");
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ class SampleTrader implements IPreSptLoadMod, IPostDBLoadMod
|
|||||||
public preSptLoad(container: DependencyContainer): void
|
public preSptLoad(container: DependencyContainer): void
|
||||||
{
|
{
|
||||||
// Get a logger
|
// Get a logger
|
||||||
this.logger = container.resolve<ILogger>("WinstonLogger");
|
this.logger = container.resolve<ILogger>("PrimaryLogger");
|
||||||
this.logger.debug(`[${this.mod}] preSpt Loading... `);
|
this.logger.debug(`[${this.mod}] preSpt Loading... `);
|
||||||
|
|
||||||
// Get SPT code/data we need later
|
// Get SPT code/data we need later
|
||||||
|
@ -14,7 +14,7 @@ class Mod implements IPreSptLoadMod, IPostSptLoadMod, IPostDBLoadMod
|
|||||||
public preSptLoad(container: DependencyContainer): void {
|
public preSptLoad(container: DependencyContainer): void {
|
||||||
// Database will be empty in here
|
// Database will be empty in here
|
||||||
const databaseServer = container.resolve<DatabaseServer>("DatabaseServer");
|
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);
|
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
|
// 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
|
// logic has modified anything yet. This is the DB loaded straight from the JSON files
|
||||||
const databaseServer = container.resolve<DatabaseServer>("DatabaseServer");
|
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);
|
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()
|
// 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
|
// 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.
|
// already been passed through the initial lifecycles (OnLoad) of SPT.
|
||||||
const databaseServer = container.resolve<DatabaseServer>("DatabaseServer");
|
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
|
// find the nvgs item again by its Id
|
||||||
const nvgs = databaseServer.getTables().templates.items["5c0558060db834001b735271"];
|
const nvgs = databaseServer.getTables().templates.items["5c0558060db834001b735271"];
|
||||||
|
@ -9,7 +9,7 @@ import { ConfigsModelBase } from "./model/ConfigsModel";
|
|||||||
class Mod implements IPreSptLoadMod {
|
class Mod implements IPreSptLoadMod {
|
||||||
public preSptLoad(container: DependencyContainer): void {
|
public preSptLoad(container: DependencyContainer): void {
|
||||||
// get logger
|
// get logger
|
||||||
const logger = container.resolve<ILogger>("WinstonLogger");
|
const logger = container.resolve<ILogger>("PrimaryLogger");
|
||||||
|
|
||||||
const importerUtil = container.resolve<ImporterUtil>("ImporterUtil");
|
const importerUtil = container.resolve<ImporterUtil>("ImporterUtil");
|
||||||
const modImporter = container.resolve<PreSptModLoader>("PreSptModLoader");
|
const modImporter = container.resolve<PreSptModLoader>("PreSptModLoader");
|
||||||
|
@ -9,7 +9,7 @@ import { ConfigsModelBase } from "./model/ConfigsModel";
|
|||||||
class Mod implements IPreSptLoadModAsync {
|
class Mod implements IPreSptLoadModAsync {
|
||||||
public async preSptLoadAsync(container: DependencyContainer): Promise<void> {
|
public async preSptLoadAsync(container: DependencyContainer): Promise<void> {
|
||||||
// get logger
|
// get logger
|
||||||
const logger = container.resolve<ILogger>("WinstonLogger");
|
const logger = container.resolve<ILogger>("PrimaryLogger");
|
||||||
|
|
||||||
const importerUtil = container.resolve<ImporterUtil>("ImporterUtil");
|
const importerUtil = container.resolve<ImporterUtil>("ImporterUtil");
|
||||||
const modImporter = container.resolve<PreSptModLoader>("PreSptModLoader");
|
const modImporter = container.resolve<PreSptModLoader>("PreSptModLoader");
|
||||||
|
@ -9,7 +9,7 @@ import { ConfigsModelBase } from "./model/ConfigsModel";
|
|||||||
class Mod implements IPreSptLoadModAsync {
|
class Mod implements IPreSptLoadModAsync {
|
||||||
public async preSptLoadAsync(container: DependencyContainer): Promise<void> {
|
public async preSptLoadAsync(container: DependencyContainer): Promise<void> {
|
||||||
// get logger
|
// get logger
|
||||||
const logger = container.resolve<ILogger>("WinstonLogger");
|
const logger = container.resolve<ILogger>("PrimaryLogger");
|
||||||
|
|
||||||
const importerUtil = container.resolve<ImporterUtil>("ImporterUtil");
|
const importerUtil = container.resolve<ImporterUtil>("ImporterUtil");
|
||||||
const modImporter = container.resolve<PreSptModLoader>("PreSptModLoader");
|
const modImporter = container.resolve<PreSptModLoader>("PreSptModLoader");
|
||||||
|
@ -13,7 +13,7 @@ import ora from "ora-classic";
|
|||||||
class Mod implements IPreSptLoadMod, IPostSptLoadMod {
|
class Mod implements IPreSptLoadMod, IPostSptLoadMod {
|
||||||
public preSptLoad(container: DependencyContainer): void {
|
public preSptLoad(container: DependencyContainer): void {
|
||||||
const vfs = container.resolve<VFS>("VFS");
|
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")));
|
const parsedJsonC = jsonc.parse(vfs.readFile(path.resolve(__dirname, "../test.jsonc")));
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ class Mod implements IPostSptLoadMod
|
|||||||
{
|
{
|
||||||
public postSptLoad(container: DependencyContainer): void {
|
public postSptLoad(container: DependencyContainer): void {
|
||||||
// get logger
|
// get logger
|
||||||
const logger = container.resolve<ILogger>("WinstonLogger");
|
const logger = container.resolve<ILogger>("PrimaryLogger");
|
||||||
|
|
||||||
// Get VFS to read in configs
|
// Get VFS to read in configs
|
||||||
const vfs = container.resolve<VFS>("VFS");
|
const vfs = container.resolve<VFS>("VFS");
|
||||||
|
@ -9,7 +9,7 @@ class Mod implements IPostSptLoadMod
|
|||||||
|
|
||||||
public postSptLoad(container: DependencyContainer): void {
|
public postSptLoad(container: DependencyContainer): void {
|
||||||
// get logger
|
// get logger
|
||||||
const logger = container.resolve<ILogger>("WinstonLogger");
|
const logger = container.resolve<ILogger>("PrimaryLogger");
|
||||||
|
|
||||||
// log the 'myProperty' value to the console
|
// log the 'myProperty' value to the console
|
||||||
logger.info(`here is the value from my config: ${this.modConfig.myProperty}`);
|
logger.info(`here is the value from my config: ${this.modConfig.myProperty}`);
|
||||||
|
@ -54,7 +54,7 @@ class Mod implements IPreSptLoadMod
|
|||||||
|
|
||||||
// This is now extra stuff we want to add
|
// This is now extra stuff we want to add
|
||||||
// We resolve 2 more dependencies: The logger and the DatabaseServer
|
// 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");
|
const dbServer = Mod.container.resolve<DatabaseServer>("DatabaseServer");
|
||||||
|
|
||||||
// As an example Im counting the amount of loaded items on the DB
|
// As an example Im counting the amount of loaded items on the DB
|
||||||
|
@ -9,7 +9,7 @@ class Mod implements IPostSptLoadMod
|
|||||||
public postSptLoad(container: DependencyContainer): void
|
public postSptLoad(container: DependencyContainer): void
|
||||||
{
|
{
|
||||||
// get logger
|
// get logger
|
||||||
const logger = container.resolve<ILogger>("WinstonLogger");
|
const logger = container.resolve<ILogger>("PrimaryLogger");
|
||||||
|
|
||||||
// Make a new instance of the 'MoreCode' class
|
// Make a new instance of the 'MoreCode' class
|
||||||
const moreCode = new MoreCode();
|
const moreCode = new MoreCode();
|
||||||
|
@ -8,7 +8,7 @@ class Mod implements IPreSptLoadMod
|
|||||||
{
|
{
|
||||||
public preSptLoad(container: DependencyContainer): void
|
public preSptLoad(container: DependencyContainer): void
|
||||||
{
|
{
|
||||||
const logger = container.resolve<ILogger>("WinstonLogger");
|
const logger = container.resolve<ILogger>("PrimaryLogger");
|
||||||
const onLoadModService = container.resolve<OnLoadModService>("OnLoadModService");
|
const onLoadModService = container.resolve<OnLoadModService>("OnLoadModService");
|
||||||
onLoadModService.registerOnLoad(
|
onLoadModService.registerOnLoad(
|
||||||
"MyCustomMod", // route key
|
"MyCustomMod", // route key
|
||||||
|
@ -7,7 +7,7 @@ import { OnUpdateModService } from "@spt/services/mod/onUpdate/OnUpdateModServic
|
|||||||
class Mod implements IPreSptLoadMod
|
class Mod implements IPreSptLoadMod
|
||||||
{
|
{
|
||||||
public preSptLoad(container: DependencyContainer): void {
|
public preSptLoad(container: DependencyContainer): void {
|
||||||
const logger = container.resolve<ILogger>("WinstonLogger");
|
const logger = container.resolve<ILogger>("PrimaryLogger");
|
||||||
const onUpdateModService = container.resolve<OnUpdateModService>("OnUpdateModService");
|
const onUpdateModService = container.resolve<OnUpdateModService>("OnUpdateModService");
|
||||||
|
|
||||||
onUpdateModService.registerOnUpdate(
|
onUpdateModService.registerOnUpdate(
|
||||||
|
@ -8,7 +8,7 @@ import type {StaticRouterModService} from "@spt/services/mod/staticRouter/Static
|
|||||||
class Mod implements IPreSptLoadMod
|
class Mod implements IPreSptLoadMod
|
||||||
{
|
{
|
||||||
public preSptLoad(container: DependencyContainer): void {
|
public preSptLoad(container: DependencyContainer): void {
|
||||||
const logger = container.resolve<ILogger>("WinstonLogger");
|
const logger = container.resolve<ILogger>("PrimaryLogger");
|
||||||
const dynamicRouterModService = container.resolve<DynamicRouterModService>("DynamicRouterModService");
|
const dynamicRouterModService = container.resolve<DynamicRouterModService>("DynamicRouterModService");
|
||||||
const staticRouterModService = container.resolve<StaticRouterModService>("StaticRouterModService");
|
const staticRouterModService = container.resolve<StaticRouterModService>("StaticRouterModService");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user