1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Updated Design: Logging Framework (markdown)

kazuhitoyokoi 2017-03-09 15:41:23 +00:00
parent d2059201b3
commit 0bdd517b04

@ -27,11 +27,11 @@ Level of logging to be recorded. Options are:
- off - no log messages at all
### metrics
When you set true in metrics, flow execution and memory usage are logged.
When you set true to metrics, Node-RED runtime outputs flow execution and memory usage.
#### Flow execution
Receive and send events in each node are outputted into the log.
For example, the following logs are outputted from the flow which has inject and debug nodes.
Received and sent events in each node are output into the log.
For example, the following logs are output from the flow which has inject and debug nodes.
```
9 Mar 13:57:53 - [metric] {"level":99,"nodeid":"8bd04b10.813f58","event":"node.inject.receive","msgid":"86c8212c.4ef45","timestamp":1489067873391}
9 Mar 13:57:53 - [metric] {"level":99,"nodeid":"8bd04b10.813f58","event":"node.inject.send","msgid":"86c8212c.4ef45","timestamp":1489067873392}
@ -46,9 +46,9 @@ Node-RED monitors memory usage every 15 second.
```
### audit
When you set true to audit, API access events are logged with end point, IP address and time stamp.
When you set true to audit, Admin HTTP API access events are logged with end point, IP address and time stamp.
#### Connect to Node-RED editor
#### Open Node-RED editor
```
9 Mar 13:49:42 - [audit] {"event":"library.get.all","type":"flow","level":98,"path":"/library/flows","ip":"127.0.0.1","timestamp":1489067382686}
9 Mar 13:49:42 - [audit] {"event":"nodes.list.get","level":98,"path":"/nodes","ip":"127.0.0.1","timestamp":1489067382786}
@ -57,17 +57,17 @@ When you set true to audit, API access events are logged with end point, IP addr
9 Mar 13:49:43 - [audit] {"event":"comms.open","level":98,"timestamp":1489067383080}
```
#### Hit deploy
#### Hit deploy button
```
9 Mar 13:47:14 - [audit] {"event":"flows.set","type":"full","version":"v2","level":98,"path":"/flows","ip":"127.0.0.1","timestamp":1489067234101}
```
#### Disconnect Node-RED editor
#### Close Node-RED editor
```
9 Mar 13:49:42 - [audit] {"event":"comms.close","level":98,"timestamp":1489067382316}
```
#### Login and hit deploy
#### Login and hit deploy button
If settings.js has access control configuration, Node-RED outputs the login users and their permission.
```
9 Mar 14:24:06 - [audit] {"event":"auth.login","username":"admin","client":"node-red-editor","scope":"*","level":98,"timestamp":1489069446376}
@ -75,7 +75,12 @@ If settings.js has access control configuration, Node-RED outputs the login user
```
## Custom logging module
Node-RED also supports custom logging module to output logs for outside of Node-RED.
Node-RED also supports custom logging module to output logs in another settings.
### Use case
- To output logs to log system outside of Node-RED
- To gather information from specific nodes
### Configuration
To use custom logger, settings.js has custom block in logging block.
```
// Configure the logging output
@ -99,4 +104,4 @@ To use custom logger, settings.js has custom block in logging block.
}
```
The configurations of level and metrics are same as console logging. handler should have custom logging handler.
The configurations of level and metrics are same as console logging. handler should have custom logging handler. You can set any name for logging module except "console".