Update readme to better explain auditer
This commit is contained in:
Родитель
32a951879c
Коммит
c40e6126d9
|
@ -85,20 +85,18 @@ const objs = require('azure-chaos-fn/parsers').resourcesToObjects(req)
|
|||
|
||||
### auditer
|
||||
|
||||
A documented implementation of the verbose logging format defined in [Auditing](https://github.com/Azure/platform-chaos/wiki/Auditing)
|
||||
A documented implementation of the verbose logging format defined in [Auditing](https://github.com/Azure/platform-chaos/wiki/Auditing). The auditer is implemented by monkeypatching the `context` instance _log_ and _done_ methods. As a developer there is little extra effort you need to do to start using the auditer. At the beginning of your extension file, initialize the auditer by passing in the eventName and resources. Then use `context.log` as usual. Everything you log will be added to an intern audit list. When you call `context.done` at the end of your extension, the internal audit list is appended to the `context.res.body` under the `__audits` property.
|
||||
|
||||
Initialize the auditer by using the following method:
|
||||
```js
|
||||
const index = require('azure-chaos-fn')
|
||||
|
||||
index.auditer(/* Azure Function context */, {
|
||||
eventName: /* Chaos event name */,
|
||||
resource: /* Target resource */
|
||||
eventName: /* Chaos event name : string */,
|
||||
resources: /* Target resources : string */
|
||||
})
|
||||
```
|
||||
|
||||
Once initialized you just need to use `context.log` as normal and anything you log will be added to an audit object that is attached the response body when you run `context.done()`. Access the audits via `res.body.__audits`.
|
||||
|
||||
See a fully implemented example in [this]() chaos event.
|
||||
> TODO: Add an example project for 'this'
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче