pino-logflare
Advanced tools
Comparing version 0.4.1 to 0.4.2-ccf600b0
import createHttpWriteStream from "./httpStream"; | ||
import createConsoleWriteStream from "./consoleStream"; | ||
import { defaultPreparePayload, extractPayloadMeta } from "./utils"; | ||
import { Level, LogEvent } from "./utils"; | ||
@@ -13,2 +14,2 @@ import { LogflareUserOptionsI } from "logflare-transport-core"; | ||
declare const createWriteStream: typeof createHttpWriteStream; | ||
export { createWriteStream, logflarePinoVercel, createPinoBrowserSend, createConsoleWriteStream, createHttpWriteStream, }; | ||
export { createWriteStream, logflarePinoVercel, createPinoBrowserSend, createConsoleWriteStream, createHttpWriteStream, defaultPreparePayload, extractPayloadMeta, }; |
@@ -17,3 +17,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createHttpWriteStream = exports.createConsoleWriteStream = exports.createPinoBrowserSend = exports.logflarePinoVercel = exports.createWriteStream = void 0; | ||
exports.extractPayloadMeta = exports.defaultPreparePayload = exports.createHttpWriteStream = exports.createConsoleWriteStream = exports.createPinoBrowserSend = exports.logflarePinoVercel = exports.createWriteStream = void 0; | ||
var httpStream_1 = __importDefault(require("./httpStream")); | ||
@@ -24,2 +24,5 @@ exports.createHttpWriteStream = httpStream_1.default; | ||
var utils_1 = require("./utils"); | ||
Object.defineProperty(exports, "defaultPreparePayload", { enumerable: true, get: function () { return utils_1.defaultPreparePayload; } }); | ||
Object.defineProperty(exports, "extractPayloadMeta", { enumerable: true, get: function () { return utils_1.extractPayloadMeta; } }); | ||
var utils_2 = require("./utils"); | ||
var logflare_transport_core_1 = require("logflare-transport-core"); | ||
@@ -33,4 +36,4 @@ var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined"; | ||
return function (level, logEvent) { | ||
var logflareLogEvent = utils_1.formatPinoBrowserLogEvent(logEvent); | ||
var maybeWithTransforms = utils_1.addLogflareTransformDirectives(logflareLogEvent, options); | ||
var logflareLogEvent = utils_2.formatPinoBrowserLogEvent(logEvent); | ||
var maybeWithTransforms = utils_2.addLogflareTransformDirectives(logflareLogEvent, options); | ||
client.postLogEvents([maybeWithTransforms]); | ||
@@ -37,0 +40,0 @@ }; |
import { LogflareUserOptionsI } from "logflare-transport-core"; | ||
import { Options } from "./httpStream"; | ||
import { Options, PayloadMeta, PreparePayloadCallback } from "./httpStream"; | ||
declare type Level = "fatal" | "error" | "warn" | "info" | "debug" | "trace"; | ||
@@ -31,3 +31,5 @@ declare type SerializerFn = (value: any) => any; | ||
declare function addLogflareTransformDirectives(item: Record<string, any>, options: LogflareUserOptionsI): Record<string, any>; | ||
export declare const extractPayloadMeta: (item: Record<string, any>) => PayloadMeta; | ||
export declare const defaultPreparePayload: PreparePayloadCallback; | ||
declare const handlePreparePayload: (item: Record<string, any>, options: Options) => Record<string, any>; | ||
export { handlePreparePayload, formatPinoBrowserLogEvent, Level, LogEvent, addLogflareTransformDirectives, }; |
@@ -25,3 +25,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.addLogflareTransformDirectives = exports.formatPinoBrowserLogEvent = exports.handlePreparePayload = void 0; | ||
exports.addLogflareTransformDirectives = exports.formatPinoBrowserLogEvent = exports.handlePreparePayload = exports.defaultPreparePayload = exports.extractPayloadMeta = void 0; | ||
function isObject(value) { | ||
@@ -110,3 +110,3 @@ return typeof value === "object" && value !== null; | ||
exports.addLogflareTransformDirectives = addLogflareTransformDirectives; | ||
var extractMeta = function (item) { | ||
var extractPayloadMeta = function (item) { | ||
var status = levelToStatus(item.level); | ||
@@ -130,2 +130,3 @@ var message = item.msg || status; | ||
}; | ||
exports.extractPayloadMeta = extractPayloadMeta; | ||
var defaultPreparePayload = function (_item, meta) { | ||
@@ -138,7 +139,8 @@ return { | ||
}; | ||
exports.defaultPreparePayload = defaultPreparePayload; | ||
var handlePreparePayload = function (item, options) { | ||
var meta = extractMeta(item); | ||
var meta = exports.extractPayloadMeta(item); | ||
var callback = options && options.onPreparePayload | ||
? options.onPreparePayload | ||
: defaultPreparePayload; | ||
: exports.defaultPreparePayload; | ||
var result = callback(item, meta); | ||
@@ -145,0 +147,0 @@ return result; |
{ | ||
"name": "pino-logflare", | ||
"version": "0.4.1", | ||
"version": "0.4.2-ccf600b0", | ||
"description": "A transport for Pino that sends messages to Logflare", | ||
@@ -81,2 +81,2 @@ "homepage": "https://github.com/logflare/pino-logflare", | ||
} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
32791
461