Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@contrast/logger

Package Overview
Dependencies
Maintainers
14
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contrast/logger - npm Package Compare versions

Comparing version 1.4.0 to 1.4.1

lib/serializers.d.ts

17

lib/index.d.ts
import { Config } from '@contrast/config';
import { Logger } from 'pino';
export { Logger };
interface Core {
import { Messages } from '@contrast/common';
import { LoggerOptions, Logger as PinoLogger, TransportTargetOptions } from 'pino';
export interface Core {
readonly config: Config;
readonly messages: Messages;
}
export default function init(core: Core): Logger;
export declare const kChildren: unique symbol;
export declare const kTransports: unique symbol;
export interface Logger extends PinoLogger {
[kChildren]: Logger[];
[kTransports]: TransportTargetOptions[];
}
export default function init(core: Core & {
logger?: Logger;
}, opts?: LoggerOptions): Logger;
//# sourceMappingURL=index.d.ts.map
"use strict";
/*
* Copyright: 2022 Contrast Security, Inc
* Copyright: 2023 Contrast Security, Inc
* Contact: support@contrastsecurity.com

@@ -16,2 +16,25 @@ * License: Commercial

*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
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) {

@@ -21,5 +44,15 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

Object.defineProperty(exports, "__esModule", { value: true });
exports.kTransports = exports.kChildren = void 0;
const common_1 = require("@contrast/common");
const pino_1 = __importDefault(require("pino"));
const serializers = __importStar(require("./serializers"));
const utils_1 = require("./utils");
function init(core) {
exports.kChildren = Symbol('contrast.logger.children');
exports.kTransports = Symbol('contrast.logger.transports');
function extend(logger, targets) {
Reflect.set(logger, exports.kChildren, []);
Reflect.set(logger, exports.kTransports, targets);
return logger;
}
function init(core, opts = {}) {
const config = core.config.agent.logger;

@@ -44,3 +77,3 @@ const targets = [

}
return (0, pino_1.default)({
const logger = core.logger = extend((0, pino_1.default)({
name: 'contrast',

@@ -56,10 +89,25 @@ level: 'trace',

...pino_1.default.stdSerializers,
/* c8 ignore next 3 */
config({ _default, _flat, _sources, ...rest }) {
return rest;
},
...serializers,
},
onChild(instance) {
this[exports.kChildren].push(extend(instance, targets));
},
...opts,
}), targets);
logger.on('level-change', (level, val, prevLevel, prevVal, instance) => {
instance[exports.kChildren].forEach(child => child.level = level);
});
logger.level = config.level ?? 'info';
if (!config.level) {
core.messages.on(common_1.Event.SERVER_SETTINGS_UPDATE, (msg) => {
const tsLevel = msg?.logger?.level?.toLowerCase();
if (tsLevel && tsLevel !== logger.level) {
logger.level = tsLevel;
logger.info('Received new log level: %s from server-features', tsLevel);
}
});
}
return core.logger;
}
exports.default = init;
//# sourceMappingURL=index.js.map
"use strict";
/*
* Copyright: 2022 Contrast Security, Inc
* Copyright: 2023 Contrast Security, Inc
* Contact: support@contrastsecurity.com

@@ -5,0 +5,0 @@ * License: Commercial

{
"name": "@contrast/logger",
"version": "1.4.0",
"version": "1.4.1",
"description": "Centralized logging for Contrast agent services",

@@ -21,4 +21,4 @@ "license": "SEE LICENSE IN LICENSE",

"dependencies": {
"pino": "^7.10.0"
"pino": "^8.15.0"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc