Utility functions for logging.
- Description:
Utility functions for logging.
- Source:
Methods
(static) createLogger(options) → {winston.Logger}
- Description:
Creates a Winston logger with a daily rotating file transport and optional console transport.
- Source:
Example
import { createLogger } from "nsuite";
export const logger = createLogger({
level: "info",
meta: {
serverName: "your-server-name",
NODE_ENV: process.env.NODE_ENV,
MODE: process.env.MODE,
},
maxLength: 1000,
filename: "./logs/application-%DATE%.log",
zippedArchive: false,
enableConsole: process.env.NODE_ENV !== "production",
});
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Configuration options for the logger. Properties
|
Returns:
- The configured Winston logger instance.
- Type
- winston.Logger
(static) logError(…args)
- Description:
记录错误消息到控制台
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
args |
* |
<repeatable> |
要记录的参数列表 |
(static) logInfo(…args)
- Description:
记录信息性消息到控制台
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
args |
* |
<repeatable> |
要记录的参数列表 |
(static) logWarn(…args)
- Description:
记录警告消息到控制台
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
args |
* |
<repeatable> |
要记录的参数列表 |