Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sumor/logger

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sumor/logger - npm Package Compare versions

Comparing version 1.2.2 to 1.2.3

2

package.json
{
"name": "@sumor/logger",
"description": "This is a lightweight logger for Node.JS. It can output logs in different levels, and you can customize the scope, id, and timezone.",
"version": "1.2.2",
"version": "1.2.3",
"license": "MIT",

@@ -6,0 +6,0 @@ "repository": "sumor-cloud/logger",

@@ -170,1 +170,27 @@ # logger

```
### Global Language Setting
```js
process.env.LANGUAGE = 'zh-CN'
import Logger from '@sumor/logger'
const code = {
info: {
USER_LOGIN: 'The user logs in and the user ID is {id}'
}
}
const i18n = {
zh: {
USER_LOGIN: '用户登录,用户ID为{id}'
}
}
const logger = new Logger({
code,
i18n
})
logger.code('USER_LOGIN', { id: 'USER001' })
// You will see the following output:
// 2020-01-01 00:00:00.000 INFO MAIN - 用户登录,用户ID为USER001
```

@@ -7,3 +7,3 @@ import getLevelMapping from './getLevelMapping.js'

const levelMapping = getLevelMapping(config.code)
const i18n = getI18n(config.language, getI18nConfig(config))
const i18nConfig = getI18nConfig(config)

@@ -13,2 +13,3 @@ return (code, parameters) => {

if (level) {
const i18n = getI18n(config.language || process.env.LANGUAGE || 'en-US', i18nConfig)
const message = i18n(code, parameters)

@@ -15,0 +16,0 @@ return {

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