New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

log2amqp

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

log2amqp - npm Package Compare versions

Comparing version 2.1.0-meta.0 to 2.1.0-meta.1

7

index.js

@@ -37,7 +37,8 @@ 'use strict';

return function getLogger (logConfig = {}) {
return function getLogger () {
let flushed = false;
let logs = [];
async function flush () {
async function flush (opts = {}) {
const { meta } = opts;
if (flushed) throw new Error('Already flushed.');

@@ -54,3 +55,3 @@ try {

logs };
if (logConfig.meta) payload.meta = logConfig.meta;
if (meta) payload.meta = meta;
await amqp.publish(config.amqp.routingKey, payload);

@@ -57,0 +58,0 @@ } catch (err) {

{
"name": "log2amqp",
"description": "Log json data to amqp from express routes.",
"version": "2.1.0-meta.0",
"version": "2.1.0-meta.1",
"author": "Tim Allen <tim@noblesamurai.com>",

@@ -6,0 +6,0 @@ "license": "BSD",

@@ -16,3 +16,2 @@ # log2amqp [![Build Status](https://travis-ci.org/noblesamurai/node-log2amqp.svg?branch=master)](http://travis-ci.org/noblesamurai/node-log2amqp) [![NPM version](https://badge-me.herokuapp.com/api/npm/log2amqp.png)](http://badges.enytc.com/for/npm/log2amqp)

};
const loggerConfig = { meta: {/*...*/} };
const Logger = require('log2amqp')(config);

@@ -23,3 +22,3 @@ let logger = Logger(loggerConfig);

logger.log('kind2', 'chris');
logger.flush().then(() => {
logger.flush({ meta: {/* ... */} }).then(() => {
// [{ kind: payload }, { kind2: 'chris' }] is flushed to amqp routingKey

@@ -29,3 +28,3 @@ });

`logerConfig.meta` defines an object you want to apply to the whole logger
`meta` defines an object you want to apply to the whole logger
session. It will be included at the top level in the logged payload (same level

@@ -32,0 +31,0 @@ as `logs`).

@@ -90,4 +90,4 @@ const chai = require('chai');

it('should include an indexable key in the message', async function () {
const logger = Logger({ meta: { blerg: 'thing' } });
await logger.flush();
const logger = Logger();
await logger.flush({ meta: { blerg: 'thing' } });
expect(publishStub.callCount).to.equal(1);

@@ -94,0 +94,0 @@ expect(publishStub.lastCall.args[1].meta).to.be.an('object');

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