Update readme to better explain auditer

This commit is contained in:
Etha-Arrowood 2018-09-14 13:41:23 -04:00
Родитель 32a951879c
Коммит c40e6126d9
1 изменённых файлов: 3 добавлений и 5 удалений

Просмотреть файл

@ -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'