@loglayer/plugin
Version:
Base plugin used to implement plugins for loglayer.
1 lines • 3.79 kB
Source Map (JSON)
{"version":3,"sources":["/home/runner/work/loglayer/loglayer/packages/core/plugin/dist/index.cjs","../src/types.ts"],"names":["PluginCallbackType"],"mappings":"AAAA;ACoEO,IAAK,mBAAA,kBAAL,CAAA,CAAKA,mBAAAA,EAAAA,GAAL;AACL,EAAAA,mBAAAA,CAAA,iBAAA,EAAA,EAAkB,iBAAA;AAClB,EAAAA,mBAAAA,CAAA,oBAAA,EAAA,EAAqB,oBAAA;AACrB,EAAAA,mBAAAA,CAAA,kBAAA,EAAA,EAAmB,kBAAA;AACnB,EAAAA,mBAAAA,CAAA,oBAAA,EAAA,EAAqB,oBAAA;AACrB,EAAAA,mBAAAA,CAAA,iBAAA,EAAA,EAAkB,iBAAA;AALR,EAAA,OAAAA,mBAAAA;AAAA,CAAA,CAAA,CAAA,mBAAA,GAAA,CAAA,CAAA,CAAA;AD3DZ;AACE;AACF,gDAAC","file":"/home/runner/work/loglayer/loglayer/packages/core/plugin/dist/index.cjs","sourcesContent":[null,"import type { ILogLayer } from \"@loglayer/shared\";\nimport type {\n PluginBeforeDataOutParams,\n PluginBeforeMessageOutParams,\n PluginShouldSendToLoggerParams,\n} from \"@loglayer/shared\";\n\nexport type {\n PluginBeforeDataOutParams,\n PluginBeforeMessageOutParams,\n PluginShouldSendToLoggerParams,\n LogLayerPluginParams,\n LogLayerPlugin,\n} from \"@loglayer/shared\";\n\nexport type { LogLevel, ILogLayer } from \"@loglayer/shared\";\n\n/**\n * Callback function for transforming the data object containing metadata, context, and error information before it's\n * sent to the logging library before it is sent to the transport library.\n *\n * @see {@link https://loglayer.dev/plugins/creating-plugins.html#onbeforedataout | onBeforeDataOut Docs}\n */\nexport type PluginBeforeDataOutFn = (params: PluginBeforeDataOutParams) => Record<string, any> | null | undefined;\n\n/**\n * Callback function for determining if the message should be sent to the transport library.\n *\n * @see {@link https://loglayer.dev/plugins/creating-plugins.html#shouldsendtologger | shouldSendToLogger Docs}\n */\nexport type PluginShouldSendToLoggerFn = (params: PluginShouldSendToLoggerParams, loglayer: ILogLayer) => boolean;\n\n/**\n * Callback function for transforming the message data before it is sent to the transport library.\n *\n * @see {@link https://loglayer.dev/plugins/creating-plugins.html#onbeforemessageout | onBeforeMessageOut Docs}\n */\nexport type PluginBeforeMessageOutFn = (params: PluginBeforeMessageOutParams, loglayer: ILogLayer) => any[];\n\n/**\n * Callback function for when `withMetadata()` or `metadataOnly()` is called.\n *\n * @see {@link https://loglayer.dev/plugins/creating-plugins.html#onmetadatacalled | onMetadataCalled Docs}\n */\nexport type PluginOnMetadataCalledFn = (\n metadata: Record<string, any>,\n loglayer: ILogLayer,\n) => Record<string, any> | null | undefined;\n\n/**\n * Callback function for when `withContext()` is called\n *\n * @see {@link https://loglayer.dev/plugins/creating-plugins.html#oncontextcalled | onContextCalled Docs}\n */\nexport type PluginOnContextCalledFn = (\n context: Record<string, any>,\n loglayer: ILogLayer,\n) => Record<string, any> | null | undefined;\n\n/**\n * List of plugin callbacks that can be called by the plugin manager.\n *\n * @see {@link https://loglayer.dev/plugins/creating-plugins.html#onbeforedataout | onBeforeDataOut Docs}\n * @see {@link https://loglayer.dev/plugins/creating-plugins.html#shouldsendtologger | shouldSendToLogger Docs}\n * @see {@link https://loglayer.dev/plugins/creating-plugins.html#onmetadatacalled | onMetadataCalled Docs}\n * @see {@link https://loglayer.dev/plugins/creating-plugins.html#onbeforemessageout | onBeforeMessageOut Docs}\n * @see {@link https://loglayer.dev/plugins/creating-plugins.html#oncontextcalled | onContextCalled Docs}\n */\nexport enum PluginCallbackType {\n onBeforeDataOut = \"onBeforeDataOut\",\n shouldSendToLogger = \"shouldSendToLogger\",\n onMetadataCalled = \"onMetadataCalled\",\n onBeforeMessageOut = \"onBeforeMessageOut\",\n onContextCalled = \"onContextCalled\",\n}\n"]}