kibana/x-pack/server/lib/audit_logger.js
Brandon Kobel 6cf34f24f6
Adding sever.logWithMetadata (#28767)
* Allowing first-class support of structured log messages

* Renaming to logWithMetadata and changing log statement structure

* Fixing unit tests
2019-01-17 09:04:53 -08:00

19 lines
542 B
JavaScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
export class AuditLogger {
constructor(server, pluginId) {
this._server = server;
this._pluginId = pluginId;
}
log(eventType, message, data = {}) {
this._server.logWithMetadata(['info', 'audit', this._pluginId, eventType], message, {
...data,
eventType,
});
}
}