loglayer Changelog
7.0.1
Patch Changes
4e3b8cdThanks @theogravity! - Fix bug where mixin plugins were not being initialized with LogLayer
7.0.0
Major Changes
#288
017be50Thanks @theogravity! - New version 7 introduces Mixins, a system for extending LogLayer and LogBuilder prototypes with custom methods and functionality. Unlike plugins (which intercept and modify log processing) or transports (which send logs to destinations), mixins add new methods directly to the LogLayer API, enabling you to integrate third-party libraries and add domain-specific capabilities beyond logging.v7 does not have any breaking changes; no migration steps are necessary to upgrade from v6 -> v7 of
loglayer.
6.10.0
Minor Changes
- #283
cca0312Thanks @theogravity! -ConsoleTransport: Fixes an issue wherelevelFieldanddateFieldshould not affect the output in the same way thatmessageFieldwould. This change brings the behavior to what is described in the documentation for theConsoleTransport.
6.9.1
Patch Changes
#277
1e01627Thanks @Eptagone! - Migration from tsup to tsdown and small dependency updates.Updated dependencies [
1e01627]:- @loglayer/context-manager@1.1.6
- @loglayer/transport@2.3.4
- @loglayer/plugin@2.1.6
- @loglayer/shared@2.5.3
6.9.0
Minor Changes
- #275
d79c827Thanks @theogravity! - Addstringifyoption toConsoleTransport
6.8.3
Patch Changes
1472439Thanks @theogravity! - Export theLogLayerContext,LogLayerMetadata,LogLayerDatatypes
6.8.2
Patch Changes
- Updated dependencies [
aa0d9e1]:- @loglayer/shared@2.5.2
- @loglayer/context-manager@1.1.5
- @loglayer/plugin@2.1.5
- @loglayer/transport@2.3.3
6.8.1
Patch Changes
#264
1038d13Thanks @Eptagone! - Improve typing for log context, metadata, and data objectsUpdated dependencies [
1038d13]:- @loglayer/shared@2.5.1
- @loglayer/context-manager@1.1.4
- @loglayer/plugin@2.1.4
- @loglayer/transport@2.3.2
6.8.0
Minor Changes
#261
9b32187Thanks @theogravity! - - Added newraw()method for advanced logging scenariosAllows bypassing the normal LogLayer API to directly specify all aspects of a log entry
Supports complete control over log level, messages, metadata, error, and context
Still processes through all LogLayer features including plugins, context merging, and transport routing
See Basic Logging documentation for usage examples
Fixed bug where
errorFieldInMetadataoption was not working correctly- Error objects were not being placed in metadata fields when
errorFieldInMetadatawas set to true - Now properly places errors in metadata fields as specified by the configuration
- Error objects were not being placed in metadata fields when
Patch Changes
- Updated dependencies [
9b32187]:- @loglayer/shared@2.5.0
- @loglayer/context-manager@1.1.3
- @loglayer/plugin@2.1.3
- @loglayer/transport@2.3.1
6.7.2
Patch Changes
- #255
f5dc038Thanks @theogravity! - Export LogLayerPlugin type
6.7.1
Patch Changes
- Updated dependencies [
94d0230]:- @loglayer/transport@2.3.0
6.7.0
Minor Changes
#239
12ca18aThanks @theogravity! - - Transports now additionally receive theerror,metadata, andcontextdata in theshipToLogger()callback. * It is still recommended to usedatafor most use-cases as it is a merged object of all data with the user's configured fields.- Plugin callbacks
onBeforeDataOut()andshouldSendToLogger()now additionally receive theerror,metadata, andcontextdata.
This change should allow a plugin or transport developer to inspect data without needing to know how the user has configured their
dataobject.- Plugin callbacks
Patch Changes
- Updated dependencies [
12ca18a]:- @loglayer/shared@2.4.0
- @loglayer/context-manager@1.1.2
- @loglayer/plugin@2.1.2
- @loglayer/transport@2.2.2
6.6.0
Minor Changes
- #222
8407ce5Thanks @theogravity! - Adds the new built-inBlankTransport, which allows quick creation of transports.
6.5.0
Minor Changes
- #218
615e257Thanks @theogravity! - Add new options to theConsoleTransportto allow auto-stamping a log level and/or date.
6.4.3
Patch Changes
#200
a2f5a17Thanks @theogravity! - Package dev dep updates, linting updatesUpdated dependencies [
a2f5a17]:- @loglayer/context-manager@1.1.1
- @loglayer/transport@2.2.1
- @loglayer/plugin@2.1.1
- @loglayer/shared@2.3.1
6.4.2
Patch Changes
98252b5Thanks @theogravity! - Export typePluginBeforeDataOutParams,PluginBeforeMessageOutParams,PluginShouldSendToLoggerParams
6.4.1
Patch Changes
- #192
449a6adThanks @theogravity! - Fixes an import issue caused by exporting LogLevel from multiple packages.
6.4.0
Minor Changes
- #190
818bae5Thanks @theogravity! - - Added the following new methods to control log levels inloglayer:setLevel()enableIndividualLevel()disableIndividualLevel()isLevelEnabled()- Fixes a bug in
metadataOnly()where it was sometimes returning the LogLayer instance instead of nothing. It should now return nothing.
Patch Changes
- Updated dependencies [
818bae5,818bae5]:- @loglayer/shared@2.3.0
- @loglayer/transport@2.2.0
- @loglayer/plugin@2.1.0
- @loglayer/context-manager@1.1.0
6.3.3
Patch Changes
- #181
a0f6f40Thanks @theogravity! - FixesMockLogLayerwherechild()andwithPrefix()was not returning itself
6.3.2
Patch Changes
- #179
b03eb3aThanks @theogravity! - Export theLogLayerTransporttype and add docs for it
6.3.1
Patch Changes
#175
a66ce9bThanks @theogravity! - Documentation updatesUpdated dependencies [
a66ce9b]:- @loglayer/context-manager@1.0.4
- @loglayer/transport@2.1.1
- @loglayer/plugin@2.0.4
- @loglayer/shared@2.2.1
6.3.0
Minor Changes
- #172
16145f1Thanks @theogravity! - Adds new methods toMockLogLayerfor better unit testing against the logger methods directly
6.2.0
Minor Changes
- #169
09e33abThanks @theogravity! - All transports now support multiple parameter passing in log methods
Patch Changes
- Updated dependencies [
09e33ab]:- @loglayer/transport@2.1.0
- @loglayer/shared@2.2.0
- @loglayer/context-manager@1.0.3
- @loglayer/plugin@2.0.3
6.1.3
Patch Changes
2dbc3a8Thanks @theogravity! - Fix link to pretty terminal gif
6.1.2
Patch Changes
#160
161029aThanks @theogravity! - external dependency version updatesUpdated dependencies [
161029a]:- @loglayer/context-manager@1.0.2
- @loglayer/transport@2.0.2
- @loglayer/plugin@2.0.2
- @loglayer/shared@2.1.1
6.1.1
Patch Changes
- #155
a7175b5Thanks @theogravity! - Fix: An empty context should not execute plugins
6.1.0
Minor Changes
#153
96a5c57Thanks @theogravity! - Updates around context and metadata handling.- Added
clearContext()to clear context data. withMetadata()/metadataOnly()/withContext()now allows an empty value. Empty values will not result in any data mutations or plugin executions.
- Added
Patch Changes
- Updated dependencies [
96a5c57]:- @loglayer/shared@2.1.0
- @loglayer/context-manager@1.0.1
- @loglayer/plugin@2.0.1
- @loglayer/transport@2.0.1
6.0.0
Major Changes
- #151
5f1260bThanks @theogravity! - - New in v6: Context Manager implementation- Breaking: Removes
linkParentContextoption fromloglayerconfiguration
- Breaking: Removes
Patch Changes
- Updated dependencies [
5f1260b,5f1260b]:- @loglayer/plugin@2.0.0
- @loglayer/transport@2.0.0
- @loglayer/context-manager@1.0.0
- @loglayer/shared@2.0.0
5.7.0
Minor Changes
- #149
213e3bcThanks @theogravity! - - AddlinkParentContextconfig option to keep context reference between child and parent- The plugin method
runOnContextCalledis no longer called duringchild()if context data exists as it'd be a redundant call.
- The plugin method
5.6.0
Minor Changes
- #143
733ba8fThanks @theogravity! - AddwithFreshPlugins()to replace existing plugins with new ones.
Patch Changes
- Updated dependencies [
733ba8f]:- @loglayer/plugin@1.3.0
- @loglayer/shared@1.3.0
- @loglayer/transport@1.2.5
5.5.1
Patch Changes
#140
d708ff7Thanks @theogravity! - FixmetadataOnlytypescript def. The second parameter should always be optional.Updated dependencies [
d708ff7]:- @loglayer/shared@1.2.1
- @loglayer/plugin@1.2.2
- @loglayer/transport@1.2.4
5.5.0
Minor Changes
- #138
54b8223Thanks @theogravity! - Add withFreshTransports method tologlayer
Patch Changes
- Updated dependencies [
54b8223]:- @loglayer/shared@1.2.0
- @loglayer/transport@1.2.3
- @loglayer/plugin@1.2.1
5.4.1
Patch Changes
- #135
b23976dThanks @theogravity! - Updates the main example code on the README.md file.
5.4.0
Minor Changes
- #129
d8054c8Thanks @theogravity! - LogLayer now passes theloglayerinstance as the last parameter to all plugin callbacks
Patch Changes
- Updated dependencies [
d8054c8]:- @loglayer/plugin@1.2.0
- @loglayer/shared@1.1.0
- @loglayer/transport@1.2.2
5.3.0
Minor Changes
#127
bf2022bThanks @theogravity! - Add new options to theConsoleTransport:messageField: Allows you to specify the field in the log message object where the message should be stored. This is useful when you want to log structured data and need to specify the field name for the message.level: Sets the minimum log level to process. Messages with a lower priority level will be ignored.
5.2.0
Minor Changes
- #122
e944b8dThanks @theogravity! - Performance improvements around using multiple transports
5.1.4
Patch Changes
#112
561a1a6Thanks @theogravity! - Update changelog doc formatting, add links to documentation siteUpdated dependencies [
561a1a6]:- @loglayer/transport@1.2.1
- @loglayer/plugin@1.1.1
- @loglayer/shared@1.0.5
Changelogs for other core libraries:
5.1.3
Patch Changes
- #110
13154edThanks @theogravity! - -loglayer: Fix an issue where if you use a plugin that creates metadata, and no metadata was present prior, it does not save@loglayer/transport-opentelemetry: Add a note about the difference between the plugin and the transport
5.1.2
Patch Changes
- Updated dependencies [
f3b89d3]:- @loglayer/transport@1.2.0
5.1.1
Patch Changes
- Updated dependencies [
06c8c20]:- @loglayer/transport@1.1.5
5.1.0
Minor Changes
- #97
c38d650Thanks @theogravity! - Add plugin lifecycle methodonContextCalledto interceptwithContextcalls
Patch Changes
- Updated dependencies [
c38d650]:- @loglayer/plugin@1.1.0
5.0.12
Patch Changes
- Updated dependencies [
d01dcb9]:- @loglayer/transport@1.1.4
5.0.11
Patch Changes
- #79
f88d492Thanks @theogravity! - - Fixes an issue where a transport will still be called even if the enabled flag for it is false- Adds the
enabled?flag to theLogLayerTransportinterface in@loglayer/transport - Updates
@loglayer/transport-datadogto not initialize the client lib if the transport is disabled
- Adds the
5.0.10
Patch Changes
- #74
d92fce0Thanks @theogravity! - Add an optionappendObjectDatainConsoleTransportto allow for the object data to be at the end of the log entry instead of the beginning.
5.0.9
Patch Changes
- #67
174f545Thanks @theogravity! - Add exports from @loglayer/plugin
5.0.8
Patch Changes
- Updated dependencies [
cef5ab1]:- @loglayer/shared@1.0.4
- @loglayer/plugin@1.0.4
- @loglayer/transport@1.1.3
5.0.7
Patch Changes
- Updated dependencies [
4a25d33]:- @loglayer/transport@1.1.2
5.0.6
Patch Changes
476702cThanks @theogravity! - Update about copy
5.0.5
Patch Changes
- Updated dependencies [
372a062]:- @loglayer/transport@1.1.1
5.0.4
Patch Changes
- Updated dependencies [
8aeeeb4]:- @loglayer/transport@1.1.0
5.0.3
Patch Changes
43ffd72Thanks @theogravity! - docs: fix up documentationUpdated dependencies [
43ffd72]:- @loglayer/transport@1.0.3
- @loglayer/plugin@1.0.3
- @loglayer/shared@1.0.3
5.0.2
Patch Changes
- Updated dependencies [
c136c0f]:- @loglayer/plugin@1.0.2
- @loglayer/shared@1.0.2
- @loglayer/transport@1.0.2
5.0.1
Patch Changes
87394f9Thanks @theogravity! - AddtransportIdparameter to pluginshouldSendToLoggercallUpdated dependencies [
87394f9,da9bc6f]:- @loglayer/plugin@1.0.1
- @loglayer/transport@1.0.1
- @loglayer/shared@1.0.1
5.0.0
Major Changes
New documentation site is available at loglayer.dev.
Migration from 4.x to 5.x is available at here.
- Introduced new transport system
- Replaced direct logger instance and type configuration with transport-specific packages
- Added new transport classes for each supported logger type
- See Transport documentation for details
- Configuration changes
- Moved error configuration options to root level (
errorSerializer,errorFieldName,copyMsgOnOnlyError) - Moved context and metadata field names to root level (
contextFieldName,metadataFieldName) - Added new
errorFieldInMetadataoption to control error object placement
- Moved error configuration options to root level (
- Removed support for Node.js 14 and 16
- Updated minimum Node.js version requirement to Node.js 18
- Updated all dependencies to their latest major versions
- Improved TypeScript type definitions and stricter type checking
- Removed deprecated APIs and legacy compatibility code
4.8.0
Minor Changes
7033d6eThanks @theogravity! - Add support for @datadog/browser-logs
4.7.0
Minor Changes
14f4ce1Thanks @theogravity! - Change messages property of ShouldSendToLoggerParams and PluginBeforeMessageOutParams toanyfromMessageDataType. This allows for more flexibility in the messages property of these params since external libraries may feed in different types of data.
4.6.1
Patch Changes
09991a3Thanks @theogravity! - Update docs
4.6.0
Minor Changes
- #40
25212bdThanks @theogravity! - AddonBeforeMessageOutcallback to plugins
4.5.0
Minor Changes
- #38
afdfbddThanks @theogravity! - - AddwithError/withMetadata/enableLogging/disableLoggingtoILogBuilder.ILogBuildernow has<ErrorType = ErrorDataType>.
4.4.1
Patch Changes
- #36
40bb3b5Thanks @theogravity! - Add enable/disableLogger to ILogLayer
4.4.0
Minor Changes
#33
1d67e1fThanks @theogravity! - Fix ILogLayer return typesILogLayer#withPrefix()andILogLayer#withChild()were of the incorrect return type.Changed to
ILogLayer<ExternalLogger, ErrorType>.
4.3.3
Patch Changes
a824b32Thanks @theogravity! - Update README copyUpdates the README intro to sound less... odd.
4.3.2
Patch Changes
58a9eaaThanks @theogravity! - Update readme intro copy
4.3.1
Patch Changes
#29
0d5a9c7Thanks @theogravity! - Fixes child transport not inheriting plugins.Before plugins, hooks were copied to the child transport, so this fix makes the behavior consistent with prior behavior.
The README for child loggers has been updated to include that plugins are now inherited.
4.3.0
Minor Changes
74756daThanks @theogravity! - AddonMetadataCalled()plugin callback to hook intowithMetadata()andmetadataOnly()calls.See the README section on
intercept metadata callsfor usage details.
Patch Changes
- #27
a6fb176Thanks @theogravity! - RefactorPluginManagerfor performance improvements.
4.2.1
Patch Changes
- #25
e5632c8Thanks @theogravity! - Readme updates
4.2.0
Minor Changes
#23
e6323b7Thanks @theogravity! - AddsignalesupportSee README.md for more details.
#20
c3b5468Thanks @theogravity! - Addlog4js-nodesupportSee README.md for more details.
#22
2dfe830Thanks @theogravity! - Addfatallog level support- Adds the
fatal()method inloglayerto write to afatallog level.- Any logging libraries that do not support
fatallevel will be written as anerrorlevel instead.
- Any logging libraries that do not support
- Adds the
#24
f989f15Thanks @theogravity! - Add consola support
4.1.1
Patch Changes
- #18
14b969cThanks @theogravity! - Tiny perf improvements
4.1.0
Minor Changes
#15
c583c94Thanks @theogravity! - Adds an optionalidfield to plugins and the ability to manage plugins.The following methods have been added:
LogLayer#removePlugin(id: string)LogLayer#enablePlugin(id: string)LogLayer#disablePlugin(id: string)
4.0.0
Major Changes
#13
d1a8cc2Thanks @theogravity! - - Removes hooks and adds a plugin system where you can define multiple hooks to run instead.- Adds esm and cjs builds to the package
Breaking Changes
- The
hooksoption has been removed - The
setHooks()method has been removed - A
pluginsoption has been added - An
addPlugins()method has been added
There will be a way to remove / disable specific plugins in a future release.
Migrating from 3.x to 4.x
Your 3.x definition may look like this:
typescript{ hooks: { onBeforeDataOut: ({ data }) => { // do something with data return data; }, shouldSendToLogger: () => { return true; } } }The 4.x version of this would look like this:
typescript{ plugins: [ { onBeforeDataOut: (data) => { // do something with data return data; }, shouldSendToLogger: () => { return true; }, }, ]; }Type changes:
LogLayerHooksConfig->LogLayerPluginHookBeforeDataOutParams->PluginBeforeDataOutParamsHookBeforeDataOutFn->PluginBeforeDataOutFnHookShouldSendToLoggerParams->PluginShouldSendToLoggerParamsHookShouldSendToLoggerFn->PluginShouldSendToLoggerFn
Summary:
- Replace
hookswithplugins - For your existing hooks, move them into the
pluginsarray where each entry is an object with the hook definition
See
README.mdfor more details.
3.1.0
- Added new configuration option
muteContextandmuteMetadatato disable context and metadata logging. - Added the following methods:
LogLayer#muteContext()LogLayer#unmuteContext()LogLayer#muteMetadata()LogLayer#unmuteMetadata()
See readme for usage details.
Internal: Switch from eslint to biomejs.dev for linting.
3.0.1
- Created a separate Typescript type for the
onBeforeDataOuthook parameter,OnBeforeDataOutParams.
3.0.0
Breaking change
- The hook
onBeforeDataOutsignature has changed- from:
onBeforeDataOut(data) - to:
onBeforeDataOut({ data, logLevel })
- from:
2.0.3
Contributor: Theo Gravity
- Adds
electron-logsupport.
2.0.2 - Mon Mar 20 2023 16:46:04
Contributor: Theo Gravity
- Exports the
HookShouldSendToLoggerParamstype and sets a default value for theDatageneric.
2.0.1 - Mon Mar 20 2023 13:19:47
Contributor: Theo Gravity
- Fixed issue where
shouldSendToLoggermay not send logs out becausemessagesmay have been manipulated.messagesis now a copy of the original.
2.0.0 - Mon Mar 20 2023 12:25:30
Contributor: Theo Gravity
Breaking change
The shouldSendToLogger hook parameter is now an object, and adds in logLevel as a property.
See README.md for updated usage details.
1.6.0 - Wed Mar 15 2023 13:25:45
Contributor: Theo Gravity
- Add
shouldSendToLoggerhook (#11)
This hook allows you to conditionally send a log entry or not to the transport.
1.5.0 - Wed Mar 01 2023 13:11:13
Contributor: Theo Gravity
- Added log message prefixing
- Can be set via
prefixconfig option, orLogLayer#withPrefix(). See README.md for usage info.
- Can be set via
- Fix issue where
LogLayer#child()was setting empty context data when context has not been set at all
1.4.2 - Wed Nov 02 2022 05:23:14
Contributor: Theo Gravity
- Fix issue where
LogLayer#child()was not creating a shallow copy of context (#10)
The documentation says the context should be shallow copied, but it wasn't. Now it is.
1.4.1 - Wed Nov 02 2022 05:06:51
Contributor: Theo Gravity
- Add support for creating child loggers (#9)
This adds a new method called LogLayer#child() that will create a new LogLayer instance with the original configuration and context data copied over.
1.3.4 - Mon Aug 22 2022 20:18:36
Contributor: Theo Gravity
- Add consoleDebug option (#7)
1.3.3 - Wed Aug 10 2022 04:17:36
Contributor: Theo Gravity
- Add config option and methods to disable / enable logging (#6)
This adds an optional config option called enabled, when set to false, will stop log output.
Corresponding methods enableLogging() and disableLogging() have also been added.
1.3.2 - Wed Aug 10 2022 02:24:37
Contributor: Theo Gravity
- Add
setHooks()method (#5)
Adds a new method on LogLayer called setHooks() that allows hooks to be set or updated after creation of the LogLayer.
Useful as an alternative to using configuration on init to set a hook
1.3.1 - Wed Aug 10 2022 02:01:35
Contributor: Theo Gravity
- Add hooks feature, add onBeforeDataOut hook (#4)
This adds the ability to register hooks with LogLayer. The first available hook, onBeforeDataOut(), allows manipulation of the data object before it is sent to the logging library.
See the README.md hooks section for more details.
1.2.1 - Tue Aug 09 2022 01:50:05
Contributor: Theo Gravity
- Fix issue where data is lost if fieldName for context and metadata is the same (#3)
If you configure the context and metadata fieldName to have the same name, only the metadata is captured, while the context is lost.
The data is now merged into the shared field.
1.1.1 - Mon Jun 13 2022 22:14:21
Contributor: Theo Gravity
- Add getContext() (#2)
Adds a new method to the transport, getContext(), which returns the current context.
1.0.2 - Mon Nov 29 2021 04:16:06
Contributor: Theo Gravity
- Update README.md
1.0.1 - Mon Nov 29 2021 03:48:11
Contributor: Theo Gravity
Make withContext() chainable (#1)
withContext()is now chainable. Most will want to call it right after creating a newLogLayerinstead of having a separate line for it.
