@am92/api-logger
Advanced tools
Comparing version
@@ -8,8 +8,8 @@ "use strict"; | ||
const winston_1 = __importDefault(require("winston")); | ||
const loggerOptions_1 = __importDefault(require("./lib/loggerOptions")); | ||
const loggerOptions_1 = require("./lib/loggerOptions"); | ||
const CONFIG_1 = require("./CONFIG"); | ||
const DEBUG_1 = __importDefault(require("./DEBUG")); | ||
const CONSTANTS_1 = __importDefault(require("./CONSTANTS")); | ||
const CONSTANTS_1 = require("./CONSTANTS"); | ||
const DEBUG_1 = require("./DEBUG"); | ||
/** @ignore */ | ||
const logger = winston_1.default.createLogger(loggerOptions_1.default); | ||
const logger = winston_1.default.createLogger(loggerOptions_1.loggerOptions); | ||
/** @ignore */ | ||
@@ -30,15 +30,16 @@ exports.apiLogger = { | ||
if (CONFIG_1.IS_PRODUCTION) { | ||
if (DEBUG_1.default.disableBlacklist) { | ||
exports.apiLogger.warn(`[${CONFIG_1.SERVICE} ApiLogger] Blacklisting Disabled as DEBUG is Set in Environment`); | ||
if (DEBUG_1.API_LOGGER_DEBUG.disableBlacklist) { | ||
exports.apiLogger.warn(`[${CONFIG_1.SERVICE} ApiLogger] Blacklisting Disabled as API_LOGGER_DEBUG is Set in Environment`); | ||
} | ||
if (!CONSTANTS_1.default.BLACKLIST_KEYS || !CONSTANTS_1.default.BLACKLIST_KEYS.length) { | ||
if (!CONSTANTS_1.API_LOGGER_CONSTANTS.BLACKLIST_KEYS || | ||
!CONSTANTS_1.API_LOGGER_CONSTANTS.BLACKLIST_KEYS.length) { | ||
exports.apiLogger.warn(`[${CONFIG_1.SERVICE} ApiLogger] Blacklisting Disabled as API_LOGGER_BLACKLIST_KEYS are Not Set in Global`); | ||
} | ||
if (!CONSTANTS_1.default.GLOBAL_MASTER_KEY_BUFFER_VALID) { | ||
if (!CONSTANTS_1.API_LOGGER_CONSTANTS.GLOBAL_MASTER_KEY_VALID) { | ||
exports.apiLogger.warn(`[${CONFIG_1.SERVICE} ApiLogger] Blacklisting using DEFAULT_MASTER_KEY`); | ||
} | ||
if (!CONSTANTS_1.default.GLOBAL_MASTER_IV_BUFFER_VALID) { | ||
if (!CONSTANTS_1.API_LOGGER_CONSTANTS.GLOBAL_MASTER_IV_VALID) { | ||
exports.apiLogger.warn(`[${CONFIG_1.SERVICE} ApiLogger] Blacklisting using DEFAULT_MASTER_IV`); | ||
} | ||
if (!DEBUG_1.default.enableDebug) { | ||
if (!DEBUG_1.API_LOGGER_DEBUG.enableDebug) { | ||
exports.apiLogger.warn(`[${CONFIG_1.SERVICE} ApiLogger] Log Levels Debug, Trace & Log are Suppressed`); | ||
@@ -49,14 +50,15 @@ } | ||
exports.apiLogger.info(`[${CONFIG_1.SERVICE} ApiLogger] Blacklisting Disabled for Non-Production Mode.`); | ||
if (DEBUG_1.default.disableBlacklist) { | ||
exports.apiLogger.warn(`[${CONFIG_1.SERVICE} ApiLogger] Blacklisting Disabled for Production Mode as DEBUG is Set in Environment`); | ||
if (DEBUG_1.API_LOGGER_DEBUG.disableBlacklist) { | ||
exports.apiLogger.warn(`[${CONFIG_1.SERVICE} ApiLogger] Blacklisting Disabled for Production Mode as API_LOGGER_DEBUG is Set in Environment`); | ||
} | ||
if (!CONSTANTS_1.default.BLACKLIST_KEYS || !CONSTANTS_1.default.BLACKLIST_KEYS.length) { | ||
if (!CONSTANTS_1.API_LOGGER_CONSTANTS.BLACKLIST_KEYS || | ||
!CONSTANTS_1.API_LOGGER_CONSTANTS.BLACKLIST_KEYS.length) { | ||
exports.apiLogger.warn(`[${CONFIG_1.SERVICE} ApiLogger] Blacklisting Disabled for Production Mode as API_LOGGER_BLACKLIST_KEYS are Not Set in Global`); | ||
} | ||
if (!CONSTANTS_1.default.GLOBAL_MASTER_KEY_BUFFER_VALID) { | ||
if (!CONSTANTS_1.API_LOGGER_CONSTANTS.GLOBAL_MASTER_KEY_VALID) { | ||
exports.apiLogger.warn(`[${CONFIG_1.SERVICE} ApiLogger] Blacklisting in Production Mode will use DEFAULT_MASTER_KEY`); | ||
} | ||
if (!CONSTANTS_1.default.GLOBAL_MASTER_IV_BUFFER_VALID) { | ||
if (!CONSTANTS_1.API_LOGGER_CONSTANTS.GLOBAL_MASTER_IV_VALID) { | ||
exports.apiLogger.warn(`[${CONFIG_1.SERVICE} ApiLogger] Blacklisting in Production Mode will use DEFAULT_MASTER_IV`); | ||
} | ||
} |
@@ -7,3 +7,2 @@ import { ApiLoggerConstants } from './TYPES'; | ||
*/ | ||
declare const CONSTANTS: ApiLoggerConstants; | ||
export default CONSTANTS; | ||
export declare const API_LOGGER_CONSTANTS: ApiLoggerConstants; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.API_LOGGER_CONSTANTS = void 0; | ||
/** @ignore */ | ||
@@ -16,17 +17,17 @@ const ENCRYPT_ALGO = 'aes-256-cbc'; | ||
/** @ignore */ | ||
const GLOBAL_MASTER_KEY_BUFFER = Buffer.from(GLOBAL_MASTER_KEY_HEX, 'hex'); | ||
const GLOBAL_MASTER_KEY_UINT8 = new Uint8Array(Buffer.from(GLOBAL_MASTER_KEY_HEX, 'hex')); | ||
/** @ignore */ | ||
const GLOBAL_MASTER_IV_BUFFER = Buffer.from(GLOBAL_MASTER_IV_HEX, 'hex'); | ||
const GLOBAL_MASTER_IV_UINT8 = new Uint8Array(Buffer.from(GLOBAL_MASTER_IV_HEX, 'hex')); | ||
/** @ignore */ | ||
const GLOBAL_MASTER_KEY_BUFFER_VALID = GLOBAL_MASTER_KEY_BUFFER.length === 32; | ||
const GLOBAL_MASTER_KEY_VALID = GLOBAL_MASTER_KEY_UINT8.length === 32; | ||
/** @ignore */ | ||
const GLOBAL_MASTER_IV_BUFFER_VALID = GLOBAL_MASTER_IV_BUFFER.length === 16; | ||
const GLOBAL_MASTER_IV_VALID = GLOBAL_MASTER_IV_UINT8.length === 16; | ||
/** @ignore */ | ||
const MASTER_KEY_BUFFER = GLOBAL_MASTER_KEY_BUFFER_VALID | ||
? GLOBAL_MASTER_KEY_BUFFER | ||
: Buffer.from(DEFAULT_MASTER_KEY_HEX, 'hex'); | ||
const MASTER_KEY_UINT8 = GLOBAL_MASTER_KEY_VALID | ||
? GLOBAL_MASTER_KEY_UINT8 | ||
: new Uint8Array(Buffer.from(DEFAULT_MASTER_KEY_HEX, 'hex')); | ||
/** @ignore */ | ||
const MASTER_IV_BUFFER = GLOBAL_MASTER_IV_BUFFER_VALID | ||
? GLOBAL_MASTER_IV_BUFFER | ||
: Buffer.from(DEFAULT_MASTER_IV_HEX, 'hex'); | ||
const MASTER_IV_UINT8 = GLOBAL_MASTER_IV_VALID | ||
? GLOBAL_MASTER_IV_UINT8 | ||
: new Uint8Array(Buffer.from(DEFAULT_MASTER_IV_HEX, 'hex')); | ||
/** | ||
@@ -37,3 +38,3 @@ * Constants for API Logger configuration including encryption settings and master keys. | ||
*/ | ||
const CONSTANTS = { | ||
exports.API_LOGGER_CONSTANTS = { | ||
TRACKING_ID: 'api-logger-tracking-id', | ||
@@ -46,7 +47,6 @@ ENCRYPT_ALGO, | ||
GLOBAL_MASTER_IV_HEX, | ||
GLOBAL_MASTER_KEY_BUFFER_VALID, | ||
GLOBAL_MASTER_IV_BUFFER_VALID, | ||
MASTER_KEY_BUFFER: new Uint8Array(MASTER_KEY_BUFFER), | ||
MASTER_IV_BUFFER: new Uint8Array(MASTER_IV_BUFFER) | ||
GLOBAL_MASTER_KEY_VALID, | ||
GLOBAL_MASTER_IV_VALID, | ||
MASTER_KEY_UINT8, | ||
MASTER_IV_UINT8 | ||
}; | ||
exports.default = CONSTANTS; |
import { ApiLoggerDebug } from './TYPES'; | ||
/** @ignore */ | ||
declare const DEBUG: ApiLoggerDebug; | ||
export default DEBUG; | ||
export declare const API_LOGGER_DEBUG: ApiLoggerDebug; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.API_LOGGER_DEBUG = void 0; | ||
const CONFIG_1 = require("./CONFIG"); | ||
@@ -17,3 +18,3 @@ const TYPES_1 = require("./TYPES"); | ||
/** @ignore */ | ||
const DEBUG = { | ||
exports.API_LOGGER_DEBUG = { | ||
disableBlacklist: false, | ||
@@ -26,4 +27,4 @@ enableDebug: false | ||
const debugFeature = debugFeaturesList.includes(feature); | ||
DEBUG[feature] = debugAll || debugFeature; | ||
if (DEBUG[feature]) { | ||
exports.API_LOGGER_DEBUG[feature] = debugAll || debugFeature; | ||
if (exports.API_LOGGER_DEBUG[feature]) { | ||
DEBUG_ENABLED_FEATURES.push(feature); | ||
@@ -35,2 +36,1 @@ } | ||
} | ||
exports.default = DEBUG; |
export * from './apiLogger'; | ||
export * from './TYPES'; | ||
export { default as namespace } from './lib/namespace'; | ||
export { default as API_LOGGER_DEBUG } from './DEBUG'; | ||
export { default as API_LOGGER_CONSTANTS } from './CONSTANTS'; | ||
export * from './lib/namespace'; | ||
export * from './DEBUG'; | ||
export * from './CONSTANTS'; |
@@ -16,14 +16,7 @@ "use strict"; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.API_LOGGER_CONSTANTS = exports.API_LOGGER_DEBUG = exports.namespace = void 0; | ||
__exportStar(require("./apiLogger"), exports); | ||
__exportStar(require("./TYPES"), exports); | ||
var namespace_1 = require("./lib/namespace"); | ||
Object.defineProperty(exports, "namespace", { enumerable: true, get: function () { return __importDefault(namespace_1).default; } }); | ||
var DEBUG_1 = require("./DEBUG"); | ||
Object.defineProperty(exports, "API_LOGGER_DEBUG", { enumerable: true, get: function () { return __importDefault(DEBUG_1).default; } }); | ||
var CONSTANTS_1 = require("./CONSTANTS"); | ||
Object.defineProperty(exports, "API_LOGGER_CONSTANTS", { enumerable: true, get: function () { return __importDefault(CONSTANTS_1).default; } }); | ||
__exportStar(require("./lib/namespace"), exports); | ||
__exportStar(require("./DEBUG"), exports); | ||
__exportStar(require("./CONSTANTS"), exports); |
import { ApiLoggerLogEntry } from '../TYPES'; | ||
/** @ignore */ | ||
export default function formatter(logObj: ApiLoggerLogEntry): string; | ||
export declare function formatter(logObj: ApiLoggerLogEntry): string; |
@@ -6,9 +6,10 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.formatter = formatter; | ||
const crypto_1 = __importDefault(require("crypto")); | ||
const util_1 = require("util"); | ||
const serializer_1 = __importDefault(require("./serializer")); | ||
const LEVEL_CONFIG_1 = __importDefault(require("./LEVEL_CONFIG")); | ||
const namespace_1 = __importDefault(require("./namespace")); | ||
const serializer_1 = require("./serializer"); | ||
const LEVEL_CONFIG_1 = require("./LEVEL_CONFIG"); | ||
const namespace_1 = require("./namespace"); | ||
const CONFIG_1 = require("../CONFIG"); | ||
const CONSTANTS_1 = __importDefault(require("../CONSTANTS")); | ||
const CONSTANTS_1 = require("../CONSTANTS"); | ||
const TYPES_1 = require("../TYPES"); | ||
@@ -32,7 +33,6 @@ /** @ignore */ | ||
const logFormatter = FORMATTER_MAP.get(level); | ||
const { inspectOptions, colorFunc } = (LEVEL_CONFIG_1.default.get(logObj.level) || LEVEL_CONFIG_1.default.get('debug')); | ||
const { inspectOptions, colorFunc } = (LEVEL_CONFIG_1.LEVEL_CONFIG.get(logObj.level) || LEVEL_CONFIG_1.LEVEL_CONFIG.get('debug')); | ||
const logString = logFormatter ? logFormatter(logObj, inspectOptions) : ''; | ||
return colorFunc ? colorFunc(logString) : logString; | ||
} | ||
exports.default = formatter; | ||
/** @ignore */ | ||
@@ -62,9 +62,10 @@ function dataFormatter(logObj, inspectOptions) { | ||
function httpFormatter(logObj) { | ||
let logMessage = ''; | ||
if (typeof logObj.message !== 'string') { | ||
logObj.message = JSON.stringify(logObj.message, serializer_1.default); | ||
logMessage = JSON.stringify(logObj.message, serializer_1.serializer); | ||
} | ||
if (!CONFIG_1.IS_PRODUCTION) { | ||
return logObj.message; | ||
return logMessage; | ||
} | ||
const { service = '', type = '', message = '', timestamp = '', trackingId = '', level, req, res } = logObj; | ||
const { service = '', type = '', timestamp = '', trackingId = '', level, req, res } = logObj; | ||
const formattedLogObj = { | ||
@@ -75,3 +76,3 @@ service, | ||
trackingId: trackingId || _getTrackingId(), | ||
message, | ||
message: logMessage, | ||
timestamp, | ||
@@ -86,4 +87,4 @@ level: level | ||
method: req.method || '', | ||
headers: req.headers ? JSON.stringify(req.headers, serializer_1.default) : '', | ||
body: req.body ? JSON.stringify(req.body, serializer_1.default) : '' | ||
headers: req.headers ? JSON.stringify(req.headers, serializer_1.serializer) : '', | ||
body: req.body ? JSON.stringify(req.body, serializer_1.serializer) : '' | ||
}; | ||
@@ -95,4 +96,4 @@ } | ||
status: res.status || '', | ||
headers: res.headers ? JSON.stringify(res.headers, serializer_1.default) : '', | ||
body: res.body ? JSON.stringify(res.body, serializer_1.default) : '', | ||
headers: res.headers ? JSON.stringify(res.headers, serializer_1.serializer) : '', | ||
body: res.body ? JSON.stringify(res.body, serializer_1.serializer) : '', | ||
responseMessage: res.responseMessage || '', | ||
@@ -112,3 +113,3 @@ responseTime: res.responseTime || -1 | ||
return CONFIG_1.IS_PRODUCTION | ||
? JSON.stringify(splatData, serializer_1.default) | ||
? JSON.stringify(splatData, serializer_1.serializer) | ||
: splatData.map(splat => { | ||
@@ -123,3 +124,3 @@ return (0, util_1.inspect)(splat, inspectOptions); | ||
msg = CONFIG_1.IS_PRODUCTION | ||
? JSON.stringify(message, serializer_1.default) | ||
? JSON.stringify(message, serializer_1.serializer) | ||
: (0, util_1.inspect)(message, inspectOptions); | ||
@@ -137,6 +138,6 @@ } | ||
function _getTrackingId() { | ||
if (namespace_1.default && namespace_1.default.active) { | ||
return namespace_1.default.get(CONSTANTS_1.default.TRACKING_ID) || ''; | ||
if (namespace_1.namespace && namespace_1.namespace.active) { | ||
return namespace_1.namespace.get(CONSTANTS_1.API_LOGGER_CONSTANTS.TRACKING_ID) || ''; | ||
} | ||
return ''; | ||
} |
import { ApiLoggerLogLevel, ApiLoggerLogLevelConfig } from '../TYPES'; | ||
/** @ignore */ | ||
declare const LEVEL_CONFIG: Map<ApiLoggerLogLevel, ApiLoggerLogLevelConfig>; | ||
export default LEVEL_CONFIG; | ||
export declare const LEVEL_CONFIG: Map<ApiLoggerLogLevel, ApiLoggerLogLevelConfig>; |
@@ -6,2 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.LEVEL_CONFIG = void 0; | ||
const chalk_1 = __importDefault(require("chalk")); | ||
@@ -24,3 +25,3 @@ /** @ignore */ | ||
/** @ignore */ | ||
const LEVEL_CONFIG = new Map([ | ||
exports.LEVEL_CONFIG = new Map([ | ||
['httpInfo', { inspectOptions, colorFunc: chalk_1.default.blueBright }], | ||
@@ -43,2 +44,1 @@ ['httpSuccess', { inspectOptions, colorFunc: chalk_1.default.greenBright }], | ||
]); | ||
exports.default = LEVEL_CONFIG; |
import { ApiLoggerOptions } from '../TYPES'; | ||
/** @ignore */ | ||
declare const loggerOptions: ApiLoggerOptions; | ||
export default loggerOptions; | ||
export declare const loggerOptions: ApiLoggerOptions; |
@@ -18,21 +18,29 @@ "use strict"; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.loggerOptions = void 0; | ||
const winston_1 = __importStar(require("winston")); | ||
const DEBUG_1 = __importDefault(require("../DEBUG")); | ||
const formatter_1 = __importDefault(require("./formatter")); | ||
const formatter_1 = require("./formatter"); | ||
const CONFIG_1 = require("../CONFIG"); | ||
const DEBUG_1 = require("../DEBUG"); | ||
/** @ignore */ | ||
const transports = [new winston_1.default.transports.Console()]; | ||
/** @ignore */ | ||
const loggerOptions = { | ||
exports.loggerOptions = { | ||
defaultMeta: { service: CONFIG_1.SERVICE }, | ||
@@ -51,7 +59,7 @@ levels: { | ||
}, | ||
level: (DEBUG_1.default.enableDebug && 'trace') || (CONFIG_1.IS_PRODUCTION ? 'info' : 'trace'), | ||
level: (DEBUG_1.API_LOGGER_DEBUG.enableDebug && 'trace') || | ||
(CONFIG_1.IS_PRODUCTION ? 'info' : 'trace'), | ||
exitOnError: false, | ||
transports, | ||
format: winston_1.format.combine(winston_1.format.timestamp({ format: 'isoDateTime' }), winston_1.format.printf(formatter_1.default)) | ||
format: winston_1.format.combine(winston_1.format.timestamp({ format: 'isoDateTime' }), winston_1.format.printf(formatter_1.formatter)) | ||
}; | ||
exports.default = loggerOptions; |
import cls from 'cls-hooked'; | ||
/** @ignore */ | ||
declare const namespace: cls.Namespace; | ||
export default namespace; | ||
export declare const namespace: cls.Namespace<Record<string, any>>; |
@@ -6,2 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.namespace = void 0; | ||
const cls_hooked_1 = __importDefault(require("cls-hooked")); | ||
@@ -11,3 +12,2 @@ /** @ignore */ | ||
/** @ignore */ | ||
const namespace = cls_hooked_1.default.createNamespace(nsid); | ||
exports.default = namespace; | ||
exports.namespace = cls_hooked_1.default.createNamespace(nsid); |
/** @ignore */ | ||
export default function serializer(key: string, value: any): any; | ||
export declare function serializer(key: string, value: any): any; |
@@ -6,10 +6,11 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.serializer = serializer; | ||
const crypto_1 = __importDefault(require("crypto")); | ||
const util_1 = require("util"); | ||
const CONSTANTS_1 = __importDefault(require("../CONSTANTS")); | ||
const DEBUG_1 = __importDefault(require("../DEBUG")); | ||
const CONSTANTS_1 = require("../CONSTANTS"); | ||
const DEBUG_1 = require("../DEBUG"); | ||
/** @ignore */ | ||
const shouldBlacklist = !DEBUG_1.default.disableBlacklist && | ||
CONSTANTS_1.default.BLACKLIST_KEYS && | ||
CONSTANTS_1.default.BLACKLIST_KEYS.length > 0; | ||
const shouldBlacklist = !DEBUG_1.API_LOGGER_DEBUG.disableBlacklist && | ||
CONSTANTS_1.API_LOGGER_CONSTANTS.BLACKLIST_KEYS && | ||
CONSTANTS_1.API_LOGGER_CONSTANTS.BLACKLIST_KEYS.length > 0; | ||
/** @ignore */ | ||
@@ -21,3 +22,3 @@ function serializer(key, value) { | ||
if (typeof value === 'string') { | ||
if (shouldBlacklist && CONSTANTS_1.default.BLACKLIST_KEYS.includes(key)) { | ||
if (shouldBlacklist && CONSTANTS_1.API_LOGGER_CONSTANTS.BLACKLIST_KEYS.includes(key)) { | ||
return _blacklistValue(value); | ||
@@ -35,3 +36,5 @@ } | ||
} | ||
if (key && shouldBlacklist && CONSTANTS_1.default.BLACKLIST_KEYS.includes(key)) { | ||
if (key && | ||
shouldBlacklist && | ||
CONSTANTS_1.API_LOGGER_CONSTANTS.BLACKLIST_KEYS.includes(key)) { | ||
return _blacklistValue(value); | ||
@@ -44,3 +47,2 @@ } | ||
} | ||
exports.default = serializer; | ||
/** @ignore */ | ||
@@ -68,3 +70,3 @@ function _blacklistValue(plainText = '') { | ||
function _blacklist(plainText) { | ||
const encryptor = crypto_1.default.createCipheriv(CONSTANTS_1.default.ENCRYPT_ALGO, CONSTANTS_1.default.MASTER_KEY_BUFFER, CONSTANTS_1.default.MASTER_IV_BUFFER); | ||
const encryptor = crypto_1.default.createCipheriv(CONSTANTS_1.API_LOGGER_CONSTANTS.ENCRYPT_ALGO, CONSTANTS_1.API_LOGGER_CONSTANTS.MASTER_KEY_UINT8, CONSTANTS_1.API_LOGGER_CONSTANTS.MASTER_IV_UINT8); | ||
const cipherTextPart = encryptor.update(`${plainText}`, 'utf8'); | ||
@@ -71,0 +73,0 @@ const cipherTextFinal = encryptor.final(); |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import { InspectOptions } from 'util'; | ||
@@ -75,13 +74,13 @@ import { LeveledLogMethod, LogEntry, LoggerOptions } from 'winston'; | ||
/** | ||
* Flag indicating if the global master key buffer is valid. | ||
* Flag indicating if the global master key is valid. | ||
* | ||
* @type {boolean} | ||
*/ | ||
GLOBAL_MASTER_KEY_BUFFER_VALID: boolean; | ||
GLOBAL_MASTER_KEY_VALID: boolean; | ||
/** | ||
* Flag indicating if the global master IV buffer is valid. | ||
* Flag indicating if the global master IV is valid. | ||
* | ||
* @type {boolean} | ||
*/ | ||
GLOBAL_MASTER_IV_BUFFER_VALID: boolean; | ||
GLOBAL_MASTER_IV_VALID: boolean; | ||
/** | ||
@@ -92,3 +91,3 @@ * Uint8Array containing the master key. | ||
*/ | ||
MASTER_KEY_BUFFER: Uint8Array; | ||
MASTER_KEY_UINT8: Uint8Array; | ||
/** | ||
@@ -99,3 +98,3 @@ * Uint8Array containing the master IV. | ||
*/ | ||
MASTER_IV_BUFFER: Uint8Array; | ||
MASTER_IV_UINT8: Uint8Array; | ||
} | ||
@@ -148,4 +147,5 @@ /** | ||
*/ | ||
export type ApiLoggerLogEntry = LogEntry & { | ||
export type ApiLoggerLogEntry = Omit<LogEntry, 'message'> & { | ||
level: ApiLoggerLogLevel | string; | ||
message: unknown; | ||
[API_LOGGER_SPLAT_KEY]?: string[]; | ||
@@ -152,0 +152,0 @@ }; |
{ | ||
"name": "@am92/api-logger", | ||
"version": "2.1.1", | ||
"version": "3.0.0", | ||
"description": "Logger for Node Backend Applications", | ||
@@ -28,14 +28,12 @@ "sideEffects": false, | ||
"dependencies": { | ||
"chalk": "^4.1.2", | ||
"cls-hooked": "^4.2.2", | ||
"winston": "^3.8.2" | ||
"chalk": "~4.1.2", | ||
"cls-hooked": "~4.2.2", | ||
"winston": "~3.17.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/plugin-transform-private-methods": "^7.24.6", | ||
"@compodoc/compodoc": "^1.1.21", | ||
"@types/cls-hooked": "^4.3.3", | ||
"@types/lodash": "^4.14.201", | ||
"@types/node": "^20.12.12", | ||
"npm-run-all": "^4.1.5", | ||
"typescript": "^5.1.3" | ||
"@compodoc/compodoc": "~1.1.26", | ||
"@types/cls-hooked": "~4.3.9", | ||
"@types/node": "~22.14.1", | ||
"npm-run-all": "~4.1.5", | ||
"typescript": "~5.8.3" | ||
}, | ||
@@ -42,0 +40,0 @@ "contributors": [ |
# @am92/api-logger | ||
[](https://www.npmjs.com/package/@am92/api-logger) | ||
[](https://snyk.io/test/npm/@am92/api-logger) | ||
[](https://opensource.org/licenses/MIT) | ||
[](https://security.snyk.io/package/npm/@am92%2Fapi-logger) | ||
[](https://npm-stat.com/charts.html?package=%40m92%2Fapi-logger) | ||
@@ -11,2 +11,6 @@ [](https://bundlephobia.com/package/@am92/api-logger) | ||
For full documentation, visit [here](https://heliumtank92.github.io/am92-api-logger). | ||
<br /> | ||
## Table of Content | ||
@@ -22,3 +26,3 @@ - [Installation](#installation) | ||
```bash | ||
$ npm install --save @am92/api-logger | ||
npm install --save @am92/api-logger | ||
``` | ||
@@ -25,0 +29,0 @@ <br /> |
5
-28.57%890
0.11%66
6.45%32940
-1.26%Updated
Updated
Updated