diff --git a/package.json b/package.json index b597d03..a38607b 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "@pushrocks/smartexpress": "^3.0.38", "@pushrocks/smartfile": "^7.0.4", "@pushrocks/smarthash": "^2.0.6", + "@pushrocks/smartlog": "^2.0.19", "@pushrocks/smartpromise": "^3.0.2", "@pushrocks/smartrequest": "^1.1.16", "@pushrocks/smartrx": "^2.0.3", diff --git a/ts/smartuniverse.classes.clientuniverse.ts b/ts/smartuniverse.classes.clientuniverse.ts index 9233d06..35c8afa 100644 --- a/ts/smartuniverse.classes.clientuniverse.ts +++ b/ts/smartuniverse.classes.clientuniverse.ts @@ -87,7 +87,6 @@ export class ClientUniverse { role: 'UniverseClient', url: parsedURL.protocol + '//' + parsedURL.hostname }; - console.log(socketConfig); this.smartsocketClient = new SmartsocketClient(socketConfig); this.observableIntake = new plugins.smartrx.ObservableIntake(); @@ -111,7 +110,7 @@ export class ClientUniverse { funcName: 'processMessage', allowedRoles: [], funcDef: async (data: interfaces.IServerUnsubscribeActionPayload) => { - console.log('Got message from server'); + plugins.smartlog.defaultLogger.log('info', 'Got message from server'); } }); @@ -120,7 +119,7 @@ export class ClientUniverse { this.smartsocketClient.addSocketFunction(socketFunctionProcessMessage); await this.smartsocketClient.connect(); - console.log('universe client connected successfully'); + plugins.smartlog.defaultLogger.log('info', 'universe client connected successfully'); await this.clientUniverseCache.channelMap.forEach(async clientUniverseChannelArg => { await clientUniverseChannelArg.subscribe(); }); diff --git a/ts/smartuniverse.classes.universe.ts b/ts/smartuniverse.classes.universe.ts index 266e3e6..8b51846 100644 --- a/ts/smartuniverse.classes.universe.ts +++ b/ts/smartuniverse.classes.universe.ts @@ -121,8 +121,9 @@ export class Universe { socketConnectionArg ); if (universeConnection) { - console.log('found UniverseConnection for socket'); + plugins.smartlog.defaultLogger.log('ok', 'found UniverseConnection for socket for incoming message'); } else { + plugins.smartlog.defaultLogger.log('warn', 'found no Authorized channel for incoming message'); return { error: 'You need to authenticate for a channel' }; @@ -149,7 +150,7 @@ export class Universe { // start everything await this.smartexpressServer.start(); await this.smartsocket.start(); - console.log('started universe'); + plugins.smartlog.defaultLogger.log('success', 'started universe'); } /** diff --git a/ts/smartuniverse.classes.universechannel.ts b/ts/smartuniverse.classes.universechannel.ts index 36ed54f..745d0db 100644 --- a/ts/smartuniverse.classes.universechannel.ts +++ b/ts/smartuniverse.classes.universechannel.ts @@ -61,12 +61,12 @@ export class UniverseChannel { if (foundChannel) { universeMessageArg.authenticated = true; universeMessageArg.universeChannelList.add(foundChannel); - console.log('message authorized'); + plugins.smartlog.defaultLogger.log('ok', 'message authorized'); return foundChannel; } else { universeMessageArg.authenticated = false; universeMessageArg.universeChannelList.add(universeCacheArg.blackListChannel); - console.log('message not valid'); + plugins.smartlog.defaultLogger.log('warn', 'message not valid'); return null; } } diff --git a/ts/smartuniverse.classes.universeconnection.ts b/ts/smartuniverse.classes.universeconnection.ts index d9d8e49..bc366ec 100644 --- a/ts/smartuniverse.classes.universeconnection.ts +++ b/ts/smartuniverse.classes.universeconnection.ts @@ -58,7 +58,6 @@ export class UniverseConnection { universeConnectionArg: UniverseConnection ): Promise { for (const authenticationRequest of universeConnectionArg.authenticationRequests) { - // TODO: authenticate channel subscriptions const universeChannelToAuthenticateAgainst = UniverseChannel.getUniverseChannelByName(universeRef, authenticationRequest.name); if (universeChannelToAuthenticateAgainst.passphrase === authenticationRequest.passphrase) { universeConnectionArg.authenticatedChannels.push(universeChannelToAuthenticateAgainst); @@ -74,7 +73,6 @@ export class UniverseConnection { connectionArg1: UniverseConnection, connectionArg2: UniverseConnection ) { - // TODO: merge connections return connectionArg1; } diff --git a/ts/smartuniverse.classes.universemessage.ts b/ts/smartuniverse.classes.universemessage.ts index 864674f..43f2d2c 100644 --- a/ts/smartuniverse.classes.universemessage.ts +++ b/ts/smartuniverse.classes.universemessage.ts @@ -91,7 +91,7 @@ export class UniverseMessage implements interfaces.IUniverseMessage { * handles bad messages for further analysis */ public handleAsBadMessage() { - console.log('received a bad message'); + plugins.smartlog.defaultLogger.log('warn', 'received a bad message'); } /** diff --git a/ts/smartuniverse.plugins.ts b/ts/smartuniverse.plugins.ts index 7390d8c..1d24080 100644 --- a/ts/smartuniverse.plugins.ts +++ b/ts/smartuniverse.plugins.ts @@ -9,6 +9,7 @@ import * as smarthash from '@pushrocks/smarthash'; import * as smartdelay from '@pushrocks/smartdelay'; import * as smartexpress from '@pushrocks/smartexpress'; import * as smartfile from '@pushrocks/smartfile'; +import * as smartlog from '@pushrocks/smartlog'; import * as smartpromise from '@pushrocks/smartpromise'; import * as smartrequest from '@pushrocks/smartrequest'; import * as smartrx from '@pushrocks/smartrx'; @@ -22,6 +23,7 @@ export { smartdelay, smartexpress, smartfile, + smartlog, smartpromise, smartrx, smartrequest,