Socket
Socket
Sign inDemoInstall

@chainsafe/lodestar-utils

Package Overview
Dependencies
Maintainers
3
Versions
843
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.20.0 to 0.21.0

lib/logger/util.d.ts

3

lib/format.d.ts
import { ByteVector } from "@chainsafe/ssz";
/**
* Format bytes as `0x1234…1234`
* 4 bytes can represent 4294967296 values, so the chance of collision is low
*/
export declare function prettyBytes(root: Uint8Array | ByteVector): string;
export declare function prettyBytes(root: Uint8Array | ByteVector | string): string;
//# sourceMappingURL=format.d.ts.map

@@ -12,7 +12,8 @@ "use strict";

* Format bytes as `0x1234…1234`
* 4 bytes can represent 4294967296 values, so the chance of collision is low
*/
function prettyBytes(root) {
const str = (0, _ssz.toHexString)(root);
const str = typeof root === "string" ? root : (0, _ssz.toHexString)(root);
return "".concat(str.slice(0, 6), "\u2026").concat(str.slice(-4));
}
//# sourceMappingURL=format.js.map

@@ -14,2 +14,6 @@ "use strict";

var _interface = require("./interface");
var _util = require("./util");
function getFormat(opts) {

@@ -27,7 +31,27 @@ switch (opts.format) {

function humanReadableLogFormat(opts) {
return _winston.format.combine(...(opts.hideTimestamp ? [] : [_winston.format.timestamp({
format: "MMM-DD HH:mm:ss.SSS"
})]), _winston.format.colorize(), _winston.format.printf(humanReadableTemplateFn));
return _winston.format.combine(...(opts.hideTimestamp ? [] : [formatTimestamp(opts)]), _winston.format.colorize(), _winston.format.printf(humanReadableTemplateFn));
}
function formatTimestamp(opts) {
const {
timestampFormat
} = opts;
switch (timestampFormat === null || timestampFormat === void 0 ? void 0 : timestampFormat.format) {
case _interface.TimestampFormatCode.EpochSlot:
return {
transform: info => {
info.timestamp = (0, _util.formatEpochSlotTime)(timestampFormat);
return info;
}
};
case _interface.TimestampFormatCode.DateRegular:
default:
return _winston.format.timestamp({
format: "MMM-DD HH:mm:ss.SSS"
});
}
}
function jsonLogFormat(opts) {

@@ -34,0 +58,0 @@ return _winston.format.combine(...(opts.hideTimestamp ? [] : [_winston.format.timestamp()]), // eslint-disable-next-line @typescript-eslint/naming-convention

@@ -29,2 +29,16 @@ /**

export declare const logFormats: LogFormat[];
export declare type EpochSlotOpts = {
genesisTime: number;
secondsPerSlot: number;
slotsPerEpoch: number;
};
export declare enum TimestampFormatCode {
DateRegular = 0,
EpochSlot = 1
}
export declare type TimestampFormat = {
format: TimestampFormatCode.DateRegular;
} | ({
format: TimestampFormatCode.EpochSlot;
} & EpochSlotOpts);
export interface ILoggerOptions {

@@ -35,2 +49,3 @@ level?: LogLevel;

hideTimestamp?: boolean;
timestampFormat?: TimestampFormat;
}

@@ -37,0 +52,0 @@ export declare type Context = string | number | boolean | bigint | null | {

@@ -6,3 +6,3 @@ "use strict";

});
exports.logFormats = exports.defaultLogLevel = exports.customColors = exports.LogLevels = exports.logLevelNum = exports.LogLevel = void 0;
exports.TimestampFormatCode = exports.logFormats = exports.defaultLogLevel = exports.customColors = exports.LogLevels = exports.logLevelNum = exports.LogLevel = void 0;

@@ -49,2 +49,9 @@ /**

exports.logFormats = logFormats;
let TimestampFormatCode;
exports.TimestampFormatCode = TimestampFormatCode;
(function (TimestampFormatCode) {
TimestampFormatCode[TimestampFormatCode["DateRegular"] = 0] = "DateRegular";
TimestampFormatCode[TimestampFormatCode["EpochSlot"] = 1] = "EpochSlot";
})(TimestampFormatCode || (exports.TimestampFormatCode = TimestampFormatCode = {}));
//# sourceMappingURL=interface.js.map

@@ -14,3 +14,3 @@ {

},
"version": "0.20.0",
"version": "0.21.0",
"main": "lib/index.js",

@@ -40,3 +40,3 @@ "files": [

"dependencies": {
"@chainsafe/ssz": "^0.8.2",
"@chainsafe/ssz": "^0.8.4",
"abort-controller": "^3.0.0",

@@ -62,3 +62,3 @@ "any-signal": "2.1.1",

],
"gitHead": "9fd4283e8523ebfa39aeb8b9f3330c30cfcd9924"
"gitHead": "58d4adda54d0b87f57c02af91345f0c2818816b9"
}

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc