fastify-graylog-reporter
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -1,2 +0,2 @@ | ||
# [1.1.0](https://github.com/Blynskyniki/fastify-graylog-reporter/compare/v1.0.0...v1.1.0) (2023-10-12) | ||
# [1.2.0](https://github.com/Blynskyniki/fastify-graylog-reporter/compare/v1.1.0...v1.2.0) (2023-10-12) | ||
@@ -6,3 +6,2 @@ | ||
* исправления ([ab31ca5](https://github.com/Blynskyniki/fastify-graylog-reporter/commit/ab31ca58ebe7a173821c3e853374cbb332a6276d)) | ||
* исправления ([3c08820](https://github.com/Blynskyniki/fastify-graylog-reporter/commit/3c088200ba6a849ad25367a970a474d014a0f897)) | ||
* chunks ([657d91f](https://github.com/Blynskyniki/fastify-graylog-reporter/commit/657d91f816d68dfcffc128b3f156ed6f27ae6c00)) |
@@ -1,2 +0,5 @@ | ||
export * from './gelfMessage'; | ||
export * from './gelf'; | ||
export * from './grayLogGelfReporter'; | ||
export * from './options'; | ||
export * from './grayLogGelfReporter'; | ||
export * from './utils'; | ||
export * from './Transport'; |
@@ -17,4 +17,7 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./gelfMessage"), exports); | ||
__exportStar(require("./gelf"), exports); | ||
__exportStar(require("./grayLogGelfReporter"), exports); | ||
__exportStar(require("./options"), exports); | ||
__exportStar(require("./grayLogGelfReporter"), exports); | ||
__exportStar(require("./utils"), exports); | ||
__exportStar(require("./Transport"), exports); | ||
//# sourceMappingURL=index.js.map |
/// <reference types="node" /> | ||
import { FastifyPluginCallback } from 'fastify'; | ||
export declare const fastifyGrayLogReporter: FastifyPluginCallback<{ | ||
facility: string; | ||
host: string; | ||
port?: number | undefined; | ||
}, import("http").Server, import("fastify").FastifyTypeProviderDefault, import("fastify").FastifyBaseLogger>; | ||
export declare const fastifyGrayLogReporter: FastifyPluginCallback<Omit<import("./Gelf").ConnectionOptions, "minCompressSize" | "maxChunkSize"> & Partial<Pick<import("./Gelf").ConnectionOptions, "minCompressSize" | "maxChunkSize">>, import("http").Server, import("fastify").FastifyTypeProviderDefault, import("fastify").FastifyBaseLogger>; |
@@ -10,8 +10,21 @@ "use strict"; | ||
const plugin = function (fastify, options, done) { | ||
const { facility, port, host } = options; | ||
const instance = new Gelf_1.Gelf(host, port); | ||
fastify.addHook('onResponse', (request, reply, done) => { | ||
const instance = new Gelf_1.GrayLogGelfReporter(options); | ||
fastify.addHook('onResponse', async (request, reply) => { | ||
const { query, params, body, headers, routerMethod, routerPath } = request; | ||
instance.sendMessage(Gelf_1.GelfMessage.fromJSON(facility, { path: routerPath, method: routerMethod, query, params, body, headers })); | ||
done(); | ||
try { | ||
await instance.report({ | ||
host: headers.location || 'empty', | ||
timestamp: +new Date(), | ||
short_message: `${routerMethod}:${routerPath} ${JSON.stringify(query || body || {})}`, | ||
path: routerPath, | ||
method: routerMethod, | ||
query, | ||
params, | ||
body, | ||
headers, | ||
}); | ||
} | ||
catch (err) { | ||
console.error(err); | ||
} | ||
}); | ||
@@ -18,0 +31,0 @@ done(); |
{ | ||
"name": "fastify-graylog-reporter", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Fastify plugin for report request data to Graylog", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/Blynskyniki/fastify-graylog-reporter#readme", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24560
31
283
2