2.1.8 • Published 7 months ago

@crowdin/logs-formatter v2.1.8

Weekly downloads
-
License
ISC
Repository
-
Last release
7 months ago

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"
2.1.8

7 months ago

2.1.7

12 months ago

2.1.6

1 year ago

2.1.5

1 year ago

2.1.4

1 year ago

2.1.3

2 years ago

2.1.2

2 years ago

2.1.1

2 years ago

2.1.0

2 years ago

2.0.6

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago