Upgrade Guide
Upgrade from Version 7.x to Version 8.x
Version 8.x is a major release that introduces some breaking changes and improvements. Please find a description of discontinued and changed features below. A full list of changes can be found in the release notes.
Removed Restify support
The restify project appears to have limited maintenance activity in recent years and is not widely used anymore. Therefore, support for the restify server framework has been removed in version 8.x.
If you are using restify, consider switching to one of the supported server frameworks and updating your configuration accordingly. See Server Framework for more details on how to set the server framework.
Removed legacy methods
Following methods have been removed in version 8.x:
forceLogger()has been removed. UsesetFrameworkto set the server framework instead.overrideCustomFieldFormat()has been removed. UsesetCustomFieldsFormatinstead.overrideNetworkField()has been removed. Please use the custom fields feature to achieve a similar behavior. See Custom Fields for more details. Alternatively, you can also configure a static field via advanced configuration. See Advanced Configuration for more details.setLogPattern()has been removed. The features was already discontinued in version 7 and is not supported anymore. Use a custom sink function to achieve a similar behavior.
Minimum Node.js version is now 22
The new minimum supported Node.js version is 22 now. If you are using an older version of Node.js, please upgrade to version 20 or later to use the latest version of the library.
Upgrade from Version 6.x to Version 7.x
Version 7.x introduces a redesigned architecture based on TypeScript. This enables the customization of generated fields and field contents and get rid of obsolete features. Below, you can find a description of discontinued, changed, and new features. Please let us know if you experience any unexpected behavior or problems that are not listed yet.
New Configuration Concept
Switching to v7 allows you to change the configuration without having to rebuild from source. Similar to the previous version, v7 loads default field configurations automatically based on the detected runtime environment and bound logging services without any further configuration. See Advanced Configuration to learn more about the new configuration concept.
TypeScript Typings
TypeScript typings are available for log levels and configuration types. Typings can be imported in addition to the default import:
import log, { Level, Framework } from "cf-nodejs-logging-support";
log.setLoggingLevel(Level.Info)
log.setFramework(Framework.Express)
Omit default values
The new version no longer writes default values (e.g. -) for unresolved values but omits the fields instead.
Discontinued log pattern feature
The log pattern feature (log.setLogPattern(<pattern>)) has been removed. It was used to set a custom formatting pattern for printing logs in a human-readable format. A similar behavior can be achieved by configuring a custom sink function that outputs the logs in the desired format.