Socket
Socket
Sign inDemoInstall

@elastic/ecs-winston-format

Package Overview
Dependencies
3
Maintainers
60
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.5.0 to 1.5.2

27

index.js

@@ -38,12 +38,2 @@ // Licensed to Elasticsearch B.V. under one or more contributor

// Comparison of Winston's `logform.json()` for JSON serialization and
// `ecsStringify()`.
// - They both use `safe-stable-stringify`.
// - Winston's exposes its `safe-stable-stringify` options, but doesn't document
// this. (https://github.com/winstonjs/logform#json)
// - Winston provides a `replacer` that converts bigints to strings. Doing
// that is debatable. The argument *for* is that a *JavaScript* JSON parser
// looses precision when parsing a bigint. The argument against is that a
// BigInt changes type to a string rather than a number.
// TODO: These differences should make it to docs somewhere.
const stringify = safeStableStringify.configure()

@@ -187,9 +177,6 @@

info['log.level'] = info.level
// Removing 'level' might cause trouble for downstream winston formatters
// given that https://github.com/winstonjs/logform#info-objects says:
//
// > Every info must have at least the level and message properties:
//
// However info still has a `info[Symbol.for('level')]` for more reliable use.
delete info.level
// Note: We do *not* remove `info.level`, even though it is not an ECS
// field, because https://github.com/winstonjs/logform#info-objects says:
// "Every info must have at least the level and message properties".
// Instead, it will be excluded from serialization in `EcsStringifyTransform`.
info['ecs.version'] = version

@@ -295,3 +282,7 @@

transform (info, opts) {
info[MESSAGE] = stringify(info)
// `info.level` must stay (see note above), but we don't want to serialize
// it, so exclude it from the stringified fields. There *is* a perf cost
// for this.
const { level, ...infoSansLevel } = info
info[MESSAGE] = stringify(infoSansLevel)
return info

@@ -298,0 +289,0 @@ }

{
"name": "@elastic/ecs-winston-format",
"version": "1.5.0",
"version": "1.5.2",
"description": "A formatter for the winston logger compatible with Elastic Common Schema.",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc