
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
promise-appenders
Advanced tools
Extend the functionality of promises with configurable appenders.
Extend the functionality of promises with configurable appenders.
Included appenders:
npm install promise-appendure
npm test
node test
node test2
var colors = require('colors'),
pro_appenders = require('promise-appenders'),
log, lne, cfu, tcf
atst = new pro_appenders().set({
"appenders": [
{ "type": "environment", "name": "test" },
{ "type": "log4js-tagline", "name": "logging" },
{ "type": "promise", "name": "a_promise" },
{ "type": "promise", "name": "another_promise" },
{ "type": "time-tracker", "name": "time-track" },
{ "type": "time-span", "name": "time-track-span" }
]
})
.on({
"name": "logging", "event": "init", "callback": lg => {
lg.log4js.configure({
appenders: { myLog: { type: 'file', filename: 'my.log' } },
categories: { default: { appenders: ['myLog'], level: 'debug' } }
})
lg.tagline = new lg.log4js_tagline(lg.log4js, {
"display": ["trace", "debug", "info", "warn", "error", "fatal", "mark"],
"output": {
"to_console": {
"show": true, "color": {
"trace": "blue",
"debug": "bgCyan",
"info": "blue",
"warn": "yellow",
"error": "red",
"fatal": "red",
"mark": "bgBlue"
}
}, /* send output to console.log */
"to_local_file": true, /* send output to the local file */
"to_datadog": false /* send output to datadog (when the datadog appender is configured) */
}
})
lg.log = lg.log4js.getLogger('myLog')
lg.log.level = 'debug'
log = lg.log
append = lg.tagline.appender('line')
lne = new append(lg.tagline).setConfig({ "format": "lne(@name(): @file:@line:@column)" })
append = lg.tagline.appender('error')
err = new append(lg.tagline)
log.info('this is an info line').tag(lne).tagline()
try {
throw new Error('Some error is thrown here.')
} catch (e) {
log.error('error line goes here').tag(err.setError(e)).tag(lne).tagline()
}
append = lg.tagline.appender('class_function')
cfu = new append(lg.tagline)
}
})
.on({
"name": "another_promise", "event": "reject", "callback": json_data => {
log.error('promise reject json(' + JSON.stringify(json_data) + ')').tag(lne).tagline()
}
})
.on({
"name": "another_promise", "event": "resolve", "callback": json_data => {
log.mark('promise resolve json(' + JSON.stringify(json_data) + ')').tag(lne).tagline()
}
})
.on({
"name": "a_promise", "event": "reject", "callback": json_data => {
log.error('promise reject json(' + JSON.stringify(json_data) + ')').tag(lne).tagline()
}
})
.on({
"name": "a_promise", "event": "resolve", "callback": json_data => {
log.info('promise resolve json(' + JSON.stringify(json_data) + ')').tag(lne).tagline()
}
})
.on({
"name": "time-track", "event": "start", "callback": json_data => {
log.debug('time start json(' + JSON.stringify(json_data) + ')').tag(lne).tagline()
}
})
.on({
"name": "time-track", "event": "stop", "callback": json_data => {
log.debug('time stop json(' + JSON.stringify(json_data) + ')').tag(lne).tagline()
}
})
.on({
"name": "time-track-span", "event": "start", "callback": json_data => {
log.debug('time start json(' + JSON.stringify(json_data) + ')').tag(lne).tagline()
}
})
.on({
"name": "time-track-span", "event": "stop", "callback": json_data => {
log.debug('time stop json(' + JSON.stringify(json_data) + ')').tag(lne).tagline()
atst.do({ "name": "another_promise", "event": "resolve", "message": atst.getSummary({ "include": ["another_promise", "time-track-span"], "message": "another_promise test done" }) })
}
})
atst.do({ "name": "logging", "event": "init", "message": "init" })
.do({ "name": "time-track-span", "event": "start", "message": "start" })
.do({ "name": "time-track", "event": "start", "message": "start" })
class testClass {
test_function() {
atst.log.debug('This will display the class/function name.').tag(cfu).tagline()
}
}
tcf = new testClass
setTimeout(function () {
try {
atst.log.info('This is start of test').tagline()
//process coding goes here. When complete stop the timer
atst.do({ "name": "time-track", "event": "stop", "message": "stop" })
setTimeout(function () {
try {
tcf.test_function() //show how the debug will log the name of the class/function
//some other processing is done. When finished stop the second timer
atst.do({ "name": "time-track-span", "event": "stop", "message": "stop" })
} catch (e) {
atst.do({ "name": "another_promise", "event": "reject", "message": e.message })
}
}, 1000)
//throw new Error('some error thrown here')
//atst.do({ "name": "a_promise", "event": "resolve", "message": atst.getSummary({ "include": ["a_promise", "time-track"], "message": "a_promise test done"})})
atst.do({ "name": "a_promise", "event": "resolve", "message": atst.getSummary({ "include": "all", "message": "a_promise test done with all parameter" }) }) //include: all will give you all summaries
atst.log.info('This is the end of test').tagline()
} catch (e) {
atst.do({ "name": "a_promise", "event": "reject", "message": e.message })
}
}, 2000)
....
[2019-08-13T14:05:18.344] [info] myLog - (msg: this is an info line) lne(init_callback(): promise-appenders/test.js:55:17)
[2019-08-13T14:05:18.347] [error] myLog - (msg: error line goes here) error(log4js_tagline.callback: Some error is thrown here.) lne(init_callback(): promise-appenders/test.js:59:21)
[2019-08-13T14:05:18.351] [debug] myLog - (msg: time start json({"time":{"name":"time-track-span","data":{"start":[617755,914044300],"stop":"","seconds":"","milliseconds":"","nanoseconds":""}}})) lne(start_callback(): promise-appenders/test.js:98:17)
[2019-08-13T14:05:18.353] [debug] myLog - (msg: time start json({"time":{"name":"time-track","data":{"start":"8/13/2019 14:5:18","stop":"","seconds":""}}})) lne(start_callback(): promise-appenders/test.js:88:17)
[2019-08-13T14:05:20.371] [info] myLog - (msg: This is start of test)
[2019-08-13T14:05:20.374] [debug] myLog - (msg: time stop json({"time":{"name":"time-track","data":{"start":"8/13/2019 14:5:18","stop":"8/13/2019 14:5:20","seconds":2}}})) lne(stop_callback(): promise-appenders/test.js:93:17)
[2019-08-13T14:05:20.376] [info] myLog - (msg: This is the end of test)
[2019-08-13T14:05:20.378] [info] myLog - (msg: promise resolve json({"success":[{"message":"a_promise test done with all parameter"},{"environment":"test"},{"logging":"log4js-tagline"},{"name":"a_promise","type":"promise"},{"name":"another_promise","type":"promise"},{"time":{"name":"time-track","data":{"start":"8/13/2019 14:5:18","stop":"8/13/2019 14:5:20","seconds":2}}},{"time":{"name":"time-track-span","data":{"start":[617755,914044300],"stop":"","seconds":"","milliseconds":"","nanoseconds":""}}}]})) lne(resolve_callback(): promise-appenders/test.js:83:17)
[2019-08-13T14:05:21.388] [debug] myLog - (msg: This will display the class/function name.) class/function name(testClass.test_function)
[2019-08-13T14:05:21.396] [debug] myLog - (msg: time stop json({"time":{"name":"time-track-span","data":{"start":[617755,914044300],"stop":[617758,952748299],"seconds":3.039076,"milliseconds":3041,"nanoseconds":3041747800}}})) lne(stop_callback(): promise-appenders/test.js:103:17)
[2019-08-13T14:05:21.401] [mark] myLog - (msg: promise resolve json({"success":[{"message":"another_promise test done"},{"name":"another_promise","type":"promise"},{"time":{"name":"time-track-span","data":{"start":[617755,914044300],"stop":[617758,952748299],"seconds":3.039076,"milliseconds":3041,"nanoseconds":3041747800}}}]})) lne(resolve_callback(): promise-appenders/test.js:73:17)
FAQs
Extend the functionality of promises with configurable appenders.
The npm package promise-appenders receives a total of 0 weekly downloads. As such, promise-appenders popularity was classified as not popular.
We found that promise-appenders 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.