-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from ralphv/rv_add_payload_to_logger
add context for logger with payload
- Loading branch information
Showing
7 changed files
with
60 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* author: Ralph Varjabedian | ||
*/ | ||
|
||
import { EngineEventContextInterface } from './index'; | ||
|
||
/** | ||
* Answers basic questions about the context of the current event and data related to it including the payload | ||
*/ | ||
export default interface EngineFullEventContextInterface extends EngineEventContextInterface { | ||
/** | ||
* Payload | ||
*/ | ||
getPayload(): any; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
import { GallifreyProvider, ProviderType } from '../interfaces/InterfaceDecorators'; | ||
import { LoggerInterface } from '../interfaces/Providers'; | ||
import { logger } from '../lib/logger'; | ||
import EngineEventContextInterface from '../engine-interfaces/EngineEventContextInterface'; | ||
import EngineFullEventContextInterface from '../engine-interfaces/EngineFullEventContextInterface'; | ||
|
||
@GallifreyProvider(ProviderType.Logger) | ||
export default class ConsoleLoggerProvider implements LoggerInterface { | ||
async debug(context: EngineEventContextInterface, message: string, payload?: any): Promise<void> { | ||
async debug(context: EngineFullEventContextInterface, message: string, payload?: any): Promise<void> { | ||
logger.debug(message, payload); | ||
} | ||
|
||
async error(context: EngineEventContextInterface, message: string, payload?: any): Promise<void> { | ||
async error(context: EngineFullEventContextInterface, message: string, payload?: any): Promise<void> { | ||
logger.error(message, payload); | ||
} | ||
|
||
async info(context: EngineEventContextInterface, message: string, payload?: any): Promise<void> { | ||
async info(context: EngineFullEventContextInterface, message: string, payload?: any): Promise<void> { | ||
logger.info(message, payload); | ||
} | ||
|
||
async warn(context: EngineEventContextInterface, message: string, payload?: any): Promise<void> { | ||
async warn(context: EngineFullEventContextInterface, message: string, payload?: any): Promise<void> { | ||
logger.warn(message, payload); | ||
} | ||
} |