Security News
cURL Project and Go Security Teams Reject CVSS as Broken
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
@ayana/logger
Advanced tools
Useful and great looking logging made easy
This is a logging library inspired by the easy use of slf4j
Besides coloring your output, this logger makes it easy to log where you are logging from. This is done by checking the __dirname
value that you pass. By that we can find out the module name and the path of your file in the module. This also works for modules in the node_modules
folder. In addition the config is global, which makes it easy to control which modules and even single classes are allowed to log at which levels.
With NPM
npm i @ayana/logger
With Yarn
yarn add @ayana/logger
IMPORTANT: All projects that use this module MUST HAVE the code that is executed in one of the following folders (checked in the order listed): build
, src
, lib
. If this is ignored the output might get messed up or the entire logger might stop working entirely.
Logger.setConfig({
level: 'INFO',
loggers: [{
name: 'helloworld:hello.Hello',
level: 'DEBUG',
}],
});
Let's say your module is called helloworld
and your JavaScript file is located in the folder src/hello
. The filename doesn't matter.
const Logger = require('@ayana/logger');
// ALWAYS use "__dirname" as the second argument
const log = Logger.get('Hello', __dirname);
class Hello {
constructor() {
log.info('Hello World!');
// Example output: 2018-07-16 18:00:00:000 INFO [helloworld:hello.Hello]: Hello World!
}
}
// You can also create a logger using a reference to the class. This will then simply use the name of the class passed.
const logOfClass = Logger.get(Hello, __dirname);
Refer to the LICENSE file.
FAQs
Useful and great looking logging made easy
We found that @ayana/logger demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.