Static Member Summary
Static Public Members | ||
public static |
The file transport for the logger. |
Constructor Summary
Public Constructor | ||
public |
constructor(PopApi: PopApi, options: Object) Create a new Logger object. |
Member Summary
Public Members | ||
public |
The log levels the logger middleware will be using. |
|
public |
The directory where the log file will be stored. |
|
public |
The name of the log file. |
Method Summary
Public Methods | ||
public |
Formatter method which formats the output to the console. |
|
public |
createHttpLogger(pretty: boolean): ExpressWinston Create a Http logger instance. |
|
public |
createLogger(pretty: boolean, quiet: boolean): Object | Winston Method to create a global logger object based on the properties of the Logger class. |
|
public |
createLoggerInstance(suffix: string, pretty: boolean): Winston Create a logger instance. |
|
public |
Formatter method which formats the output to the log file. |
|
public |
getConsoleTransport(pretty: boolean): Object Create a Console transport. |
|
public |
getFileTransport(file: string): Object Create a File transport. |
|
public |
getHttpLoggerMessage(req: Object, res: Object): string Get the log message for Http logger. |
|
public |
getLevelColor(level: string): string Get the color of the output based on the log level. |
|
public |
Get a logger object based on the choice. |
|
public |
prettyPrintConsole(info: Object): Object Update the message property and add the splat property to the info object for interpolation. |
Private Methods | ||
private |
_getMessage(info: Object): string Get the message string from the info object. |
Public Constructors
public constructor(PopApi: PopApi, options: Object) source
Create a new Logger object.
Params:
Name | Type | Attribute | Description |
PopApi | PopApi |
|
The PopApi instance to bind the logger to. |
options | Object |
|
The options for the logger. |
options.name | string |
|
The name of the log file. |
options.pretty | boolean |
|
Pretty mode for output with colors. |
options.quiet | boolean |
|
No output. |
Throw:
'name' and 'logDir' are required options for the Logger middleware! |
Public Members
Public Methods
public createHttpLogger(pretty: boolean): ExpressWinston source
Create a Http logger instance.
Params:
Name | Type | Attribute | Description |
pretty | boolean |
|
Pretty mode for output with colors. |
public createLogger(pretty: boolean, quiet: boolean): Object | Winston source
Method to create a global logger object based on the properties of the Logger class.
public createLoggerInstance(suffix: string, pretty: boolean): Winston source
Create a logger instance.
public getConsoleTransport(pretty: boolean): Object source
Create a Console transport.
Params:
Name | Type | Attribute | Description |
pretty | boolean |
|
Pretty mode for output with colors. |
public getFileTransport(file: string): Object source
Create a File transport.
Params:
Name | Type | Attribute | Description |
file | string |
|
The file to log the output to. |
public getHttpLoggerMessage(req: Object, res: Object): string source
Get the log message for Http logger.
public getLevelColor(level: string): string source
Get the color of the output based on the log level.
Params:
Name | Type | Attribute | Description |
level | string |
|
The log level. |
public getLogger(type: string, pretty: boolean, quiet: boolean): Middleware | Winston | undefined source
Get a logger object based on the choice.
public prettyPrintConsole(info: Object): Object source
Update the message property and add the splat property to the info object for interpolation.
Params:
Name | Type | Attribute | Description |
info | Object | The info object processed by logform. |