
Product
Introducing Immutable Scans
Scan results now load faster and remain consistent over time, with stable URLs and on-demand rescans for fresh security data.
@sumor-cloud/logger
Advanced tools
Sumor Logger aims to provide a universal logging format, color differentiation, cross-time zone, multi-language, and highly scalable logging interface.
Sumor Logger aims to provide a universal logging format, color differentiation, cross-time zone, multi-language, and highly scalable logging interface.
A Sumor Cloud Tool.
More Documentation
npm install -D @sumor-cloud/logger
import Logger from '@sumor-cloud/logger';
const logger = new Logger();
logger.trace("Hello World!");
// You will see the following output:
// 2020-01-01 00:00:00.000 TRACE DEFAULT - Hello World!
For some case, we need categorize logs. scope is used for this purpose.
import Logger from '@sumor-cloud/logger';
const logger = new Logger({
scope: 'DEMO'
});
logger.trace("Hello World!");
// You will see the following output:
// 2020-01-01 00:00:00.000 TRACE DEMO - Hello World!
For some case, we need identifier user. id is used for this purpose.
import Logger from '@sumor-cloud/logger';
const logger = new Logger({
id: 'USER001'
});
logger.trace("Hello World!");
// You will see the following output:
// 2020-01-01 00:00:00.000 TRACE DEFAULT USER001 - Hello World!
Most of the time, we only need to output logs of a certain level. Then we can decide if store and display it or not.
import Logger from '@sumor-cloud/logger';
const logger = new Logger();
logger.trace("Hello World!"); // trace is the lowest level, all logs will be output
logger.debug("Hello World!");
logger.info("Hello World!");
logger.warn("Hello World!");
logger.error("Hello World!");
logger.fatal("Hello World!"); // fatal is the highest level, only critical error will be output
import Logger from '@sumor-cloud/logger';
const logger = new Logger({
i18n:{
"SAY_HELLO":"Hello, {user}"
}
});
logger.info("SAY_HELLO",{user:"Sumor"});
// You will see the following output:
// 2020-01-01 00:00:00.000 INFO DEFAULT - Hello, Sumor
import Logger from '@sumor-cloud/logger';
const logger1 = new Logger({
offset: 2 * 60 // UTC+2 offset is 2 hours
});
logger1.info("Hello World!");
// You will see the following output:
// 2020-01-01 02:00:00.000 INFO DEFAULT - Hello World!
const logger2 = new Logger({
offset: 8 * 60 // UTC+8 offset is 8 hours
});
logger2.info("Hello World!");
// You will see the following output:
// 2020-01-01 08:00:00.000 INFO DEFAULT - Hello World!
Usually, we need to save logs to a file. We can add saver to the logger.
import Logger from '@sumor-cloud/logger';
const logger = new Logger({
saver: (message) => {
// save message to file
fs.appendFileSync('main.log', message);
}
});
Sometimes, you may need to load logs from a file. We can use load method to resume the logs. And also, you can use this to switch log language as well by passing different i18n.
import Logger from '@sumor-cloud/logger';
const logger = new Logger({
i18n:{
"SAY_HELLO":"Morning, {user}"
}
});
logger.info("SAY_HELLO",{user:"Sumor"});
// You will see the following output:
// 2020-01-01 00:00:00.000 INFO DEFAULT - Morning, Sumor
You can use this tool for free.
But we are a commercial company, to ensure stability, we currently don't offer a joint contribution mechanism.
You can report issues through Report Library Issue Ticket, and we will fix them as soon as possible.
In consideration of the chaotic situation in the open source community, we provide obfuscated code for use and security analysis.
However, we do not provide the source code in its original form in order to protect the ongoing maintenance and creative interests and motivations.
The released code in NPMJS is based on MIT. The source code is closed-source.
Our tools are free to use in order to help build cloud applications more efficiently. Our commercial purpose is to improve the ecosystem of business websites.
If there are any innovations that greatly benefit the open source community, it will be separated and contributed to the open source community.
FAQs
Sumor Logger aims to provide a universal logging format, color differentiation, cross-time zone, multi-language, and highly scalable logging interface.
The npm package @sumor-cloud/logger receives a total of 0 weekly downloads. As such, @sumor-cloud/logger popularity was classified as not popular.
We found that @sumor-cloud/logger demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Product
Scan results now load faster and remain consistent over time, with stable URLs and on-demand rescans for fresh security data.

Product
Socket's new Alert Details page is designed to surface more context, with a clearer layout, reachability dependency chains, and structured review.

Product
Campaign-level threat intelligence in Socket now shows when active supply chain attacks affect your repositories and packages.