Socket
Book a DemoInstallSign in
Socket

@crowdin/logs-formatter

Package Overview
Dependencies
Maintainers
3
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@crowdin/logs-formatter

Used in Crowdin Apps to output console logs in JSON format

2.1.8
latest
npmnpm
Version published
Maintainers
3
Created
Source

Crowdin Logs Formatter

This module is designed to modify the standard console methods, ensure that the messages are properly formatted for integration with the ELK, and provide middleware for Express to work seamlessly with these methods on the frontend:

coverage report

const logsFormatter = require('@crowdin/logs-formatter');
logsFormatter.setup();

const app = express();
app.use(express.json({ limit: '50mb' }));

app.use(logsFormatter.expressMiddleware());
app.use(logsFormatter.contextResolverMiddleware());

List of console methods to be modified

console.log();
console.debug();
console.info();
console.warn();
console.trace();
console.error();
console.fatal();

Use the setContext method to set parameters for user identification. Here's an example

setContext({ project: { id: 1, identifier: 'newproject', organization_id: 200000001, user_id: 12 } })

While ELK supports a variety of attributes, note that not all of them are included in the current version of this formatter. Some examples of these attributes are:

"user.id", "user.login", "project.id", "project.identifier", "organization.id", "organization.domain", "client.ip" 
"user_agent.original", "http.request.referrer", "url.original", "extra.attributes", "extra.backtrace"

FAQs

Package last updated on 31 Mar 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.