
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Yet another JSON logger. I like Ruby's logger, but it's annoying to
always set it up. I like flexible, machine and human readable logs.
I want simplicity and brevity. I want to dump JSON in my logs
without screwing around, and I want to be able to easily log text.
I don't want to be constantly setting progname
. I want to be able
to override the right things (like progrname) but I also always want
UTC and overriding id's is overkill.
Add this line to your application's Gemfile:
gem 'yajl'
And then execute:
$ bundle
Or install it yourself as:
$ gem install yajl
Yajl relies on git
to determine what the root filepath is.
Since every single project that I have uses git
, I decided
to just make it mandatory.
cd [git repo] && irb
require 'yajl'
logger = Yajl.create_logger
logger.warn "danger"
Will produce the following (although it has been pretty printed for readability):
{
"id": "44fa7a8f0186092d849ac1ea263ceb3f",
"severity": "WARN",
"datetime": "2015-08-24 18:22:12 UTC",
"progname": "(irb)",
"message": {
"text": "danger"
}
}
Note that progname is normally set from the context of the root
git directory. E.g., lib/yajl/version.rb
.
You can also log data structures:
require 'yajl'
logger = Yajl.create_logger
interesting_data = { banana_count: 2345, text: "So many bananas!" }
logger.info interesting_data
Which produces:
{
"datetime": "2015-08-24 18:43:24 UTC",
"id": "4ae209a739a7bb562d7b55dfba88fc4e",
"message": {
"banana_count": 2345,
"text": "So many bananas!"
},
"progname": "(irb)",
"severity": "INFO"
}
And because it is just a normal Ruby logger, you can also do:
require 'yajl'
logger = Yajl.create_logger
logger.fatal("deathstar") { "Nooooo" }
Which overrides the progname
attribute.
{
"datetime": "2015-08-24 18:48:37 UTC",
"id": "3e6dfcc2038dd0dec5e4be21574cb76d",
"message": {
"text": "Nooooo"
},
"progname": "deathstar",
"severity": "FATAL"
}
By default logs are stored in ~/logs
with a very sensible
logger name. If even one person wants the ability to change the
filename that is set I'll add the support to do so. Right now it
looks like this (Where yajl
would be the name of whatever git
repo you are using):
/home/zach/logs/zach@Lux.yajl.log
or like this:
/home/zach/logs/zach@Lux.yajl.log.1
If there are multiple running processes (just like the normal Ruby logger).
Note, it gets the name of the project from your Git project name. If you don't use Git let me know and I'll make this toggleable too.
After checking out the repo, run bin/setup
to install
dependencies. You can also run bin/console
for an interactive
prompt that will allow you to experiment.
To install this gem onto your local machine, run
bundle exec rake install
.
To release a new version, update the version number in
version.rb
, and then run bundle exec rake release
, which
will create a git tag for the version, push git commits and tags,
and push the .gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/zachaysan/yajl. Matz is nice. Be like Matz.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that yajl 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
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.