Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
logifys
Advanced tools
Readme
yarn add logifys
or
npm install logifys
To use LOGIFYS, simply import the package and call the log
function:
const log = require('logifys');
// log message with default options
log('This is a simple log message');
// log message with custom font, color, background color and size
log('This is a custom log message', {
font: 'bold',
color: 'red',
backgroundColor: 'yellow',
size: '36px'
});
// log message with file and json options
log('This is a log message with file and json options', {
font: 'italic',
color: 'green',
size: '20px',
file: './logs.txt',
json: true
});
LOGIFYS makes logging easier and nicer to look at with its extensive selection of fonts and colors.
LOGIFYS supports the following colors:
LOGIFYS supports the following background colors:
:warning: WARNING |
---|
Not all consoles support sizing |
LOGIFYS supports the following sizes:
:warning: WARNING |
---|
JSON Support is in beta, use at your own risk. |
LOGIFYS supports jsons:
const log = require('logifys');
// log message with file and json options
log('This is a log message with file and json options', {
font: 'italic',
color: 'green',
size: '20px',
file: './logs.txt',
json: true
});
LOGIFYS supports the following fonts:
Here is a simple proof of concept for LOGIFYS:
const log = require('logifys');
var points = new Array(100);
for (var i = 0; i < 100; i++) {
points[i] = i + 1;
}
for (var i = 0; i < points.length; i++) {
log(points[i], { font: 'bold', color: 'magenta' });
}
This code will produce the following output:
Here is an example of how the logging to .txt works:
const log = require('logifys');
log('This is an example of logging...', { font: 'bold', color: 'red', file: './log.txt' });
This code will produce the following output:
This code will result it being logged in a .txt file as shown:
Here is an example of how you might use Logifys in a real world scenario:
const log = require('logifys');
const fs = require('fs');
const https = require('https');
// Your code to fetch data from an API
https.get('https://jsonplaceholder.typicode.com/posts', (res) => {
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
try {
const posts = JSON.parse(data);
log(`Successfully fetched ${posts.length} posts`, { color: 'green', file: './log.txt' });
} catch (error) {
log(`Error fetching posts: ${error}`, { color: 'red', file: './log.txt' });
}
});
});
// Your code to write to a file
fs.writeFile('./notes.txt', 'Remember to buy milk', (error) => {
if (error) {
log(`Error writing to file: ${error}`, { color: 'red', file: './log.txt' });
} else {
log(`Successfully wrote to file`, { color: 'green', file: './log.txt' });
}
});
Here is an example of how you might use Logifys in a web development scenario:
const log = require('logifys');
const express = require('express');
const app = express();
const port = process.env.PORT || 3000;
app.listen(port, () => {
log(`Server is listening on port ${port}`, { font: 'bold', color: 'green' });
});
app.get('/', (req, res) => {
log('Received a request to the root endpoint', { font: 'italic', color: 'blue' });
res.send('Welcome to the Express server!');
});
app.use((error, req, res, next) => {
log(`Error: ${error.message}`, { font: 'underline', color: 'red' });
res.status(500).send('An error occurred, please try again later.');
});
FAQs
Let's make logs easier!
The npm package logifys receives a total of 1 weekly downloads. As such, logifys popularity was classified as not popular.
We found that logifys 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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.