logging-utils
Advanced tools
Comparing version 4.0.11 to 4.0.12
'use strict'; | ||
// Dependencies | ||
const strings = require('core-functions/strings'); | ||
const isNotBlank = strings.isNotBlank; | ||
const isString = strings.isString; | ||
const stringify = strings.stringify; | ||
const copying = require('core-functions/copying'); | ||
const copy = copying.copy; | ||
const merging = require('core-functions/merging'); | ||
const merge = merging.merge; | ||
const booleans = require('core-functions/booleans'); | ||
const isBoolean = booleans.isBoolean; | ||
/** | ||
@@ -49,20 +63,15 @@ * Utilities to configure simple log-level based console logging. | ||
*/ | ||
// Exports | ||
exports.isLoggingConfigured = isLoggingConfigured; | ||
exports.configureLogging = configureLogging; | ||
exports.getDefaultLoggingOptions = getDefaultLoggingOptions; | ||
exports.log = log; | ||
exports.isValidLogLevel = isValidLogLevel; | ||
exports.cleanLogLevel = cleanLogLevel; | ||
exports.isMinimumViableLogger = isMinimumViableLogger; | ||
// exports.FOR_TESTING_ONLY = {loadDefaultLoggingOptions, toLoggingSettingsWithDefaults} | ||
// Dependencies | ||
const Strings = require('core-functions/strings'); | ||
const isNotBlank = Strings.isNotBlank; | ||
const isString = Strings.isString; | ||
const stringify = Strings.stringify; | ||
const copying = require('core-functions/copying'); | ||
const copy = copying.copy; | ||
const merging = require('core-functions/merging'); | ||
const merge = merging.merge; | ||
function noop() { | ||
} | ||
const booleans = require('core-functions/booleans'); | ||
const isBoolean = booleans.isBoolean; | ||
/** | ||
@@ -81,2 +90,3 @@ * An enum for the various logging levels supported | ||
Object.freeze(LogLevel); | ||
exports.LogLevel = LogLevel; | ||
@@ -94,30 +104,3 @@ /** | ||
// Exports | ||
module.exports = { | ||
/** Valid log levels */ | ||
LogLevel: LogLevel, | ||
/** Returns true, if the given target already has logging functionality configured on it; otherwise returns false. */ | ||
isLoggingConfigured: isLoggingConfigured, | ||
/** Configures a target object with logging functionality using given logging settings (if any) or using default logging settings partially overridden by given logging options (if any) */ | ||
configureLogging: configureLogging, | ||
/** Returns a clean and complete copy of the default logging options */ | ||
getDefaultLoggingOptions: getDefaultLoggingOptions, | ||
/** A convenience function that delegates the logging to the log method of the given logger or of console */ | ||
log: log, | ||
isValidLogLevel: isValidLogLevel, | ||
cleanLogLevel: cleanLogLevel, | ||
isMinimumViableLogger: isMinimumViableLogger | ||
// FOR_TESTING_ONLY: { | ||
// /** Loads a clean, but potentially incomplete, copy of the default logging options from the local default-options.json file */ | ||
// loadDefaultLoggingOptions: loadDefaultLoggingOptions, | ||
// toLoggingSettingsWithDefaults: toLoggingSettingsWithDefaults | ||
// } | ||
}; | ||
/** | ||
@@ -277,3 +260,3 @@ * Returns true, if the given target already has logging functionality configured on it; otherwise returns false. | ||
target.info(`Logging configured with level ${logLevel}, with${useLevelPrefixes ? '' : 'out'} prefixes, with env log level name '${envLogLevelName}' & with${useConsoleTrace ? '' : 'out'} console.trace`); | ||
target.debug(`Logging configured with level ${logLevel}, with${useLevelPrefixes ? '' : 'out'} prefixes, with env log level name '${envLogLevelName}' & with${useConsoleTrace ? '' : 'out'} console.trace`); | ||
@@ -412,3 +395,3 @@ return target; | ||
} else if (logger && typeof logger.info === 'function') { | ||
// If a logger was provided & it has a log method, then use it | ||
// If a logger was provided & it has a log method, then use it | ||
logger.info.apply(logger, args); | ||
@@ -415,0 +398,0 @@ } else { |
{ | ||
"name": "logging-utils", | ||
"description": "Utilities for configuring simple log level based logging functionality on an object", | ||
"version": "4.0.11", | ||
"version": "4.0.12", | ||
"author": "Byron du Preez", | ||
@@ -16,7 +16,7 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"core-functions": "3.0.11" | ||
"core-functions": "3.0.13" | ||
}, | ||
"devDependencies": { | ||
"tape": "^4.7.0" | ||
"tape": "^4.8.0" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# logging-utils v4.0.11 | ||
# logging-utils v4.0.12 | ||
Utilities for configuring simple log level based logging functionality on an object. | ||
@@ -3,0 +3,0 @@ |
## Changes | ||
### 4.0.12 | ||
- Changed all exports to modifications of the default `exports` object instead of replacing the default object | ||
- Updated `core-functions` dependency to version 3.0.13 | ||
### 4.0.11 | ||
@@ -4,0 +8,0 @@ - Updated `core-functions` dependency to version 3.0.11 |
109109
1562
+ Addedcore-functions@3.0.13(transitive)
- Removedcore-functions@3.0.11(transitive)
Updatedcore-functions@3.0.13