winstonjs / winston-redis Goto Github PK
View Code? Open in Web Editor NEWA fixed-length Redis transport for winston
Home Page: http://github.com/winstonjs/winston-redis
License: MIT License
A fixed-length Redis transport for winston
Home Page: http://github.com/winstonjs/winston-redis
License: MIT License
When installing:
$ npm install winston-redis
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/redis
npm ERR! redis@"^3.1.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer redis@"^2.8.0" from [email protected]
npm ERR! node_modules/winston-redis
npm ERR! winston-redis@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
After removing redis, I saw the winston-redis package.json use older version of redis (2.8.0) :
{
"name": "winston-redis",
"description": "A fixed-length Redis transport for winston",
"version": "3.1.0",
"author": "Charlie Robbins <[email protected]>",
"repository": {
"type": "git",
"url": "[email protected]:winstonjs/winston-redis.git"
},
"keywords": [
"logging",
"sysadmin",
"tools",
"winston",
"redis"
],
"dependencies": {
"async": "^2.6.1",
"lodash": "^4.6.1",
"winston-transport": "^4.2.0"
},
"devDependencies": {
"abstract-winston-transport": "^0.5.1",
"mocha": "^5.2.0",
"redis": "^2.8.0"
},
"peerDependencies": {
"redis": "^2.8.0",
"winston": "^3.0.0"
},
"main": "./lib/winston-redis",
"scripts": {
"test": "mocha test/*-test.js --exit"
},
"engines": {
"node": ">=8.11.x"
},
"license": "MIT"
}
Given this code:
logger.log({
level: 'info',
message: 'My message',
additional: 'More stuff'
});
Other transports, such as File transport, log this JSON:
{"level":"info","message":"My message","additional":"More stuff"}
Whereas winston-redis logs this JSON:
{"level":"info","message":"My message","meta":{"additional":"More stuff"}}
Is it possible to add an option to log the meta data at the top level rather than as a child property?
Redis 0.8.1 removes the hiredis optional dependency, preventing it from failing to build on SmartOS and causing npm to report a failure. This fixes an issue on Nodejitsu, since we use SmartOS on Joyent. Thanks!
I'm running the beta version of this module and an bit older version of node
[email protected]
node v7.10.1
in line 84 of lib/winston-redis.js
https://github.com/winstonjs/winston-redis/blob/master/lib/winston-redis.js#L85
const { level, message, ...winstonMeta } = info
const meta = Object.assign({}, winstonMeta, this.metadata)
the ...
operator is usually used with unpacking the values of an array or skipping over values during the deconstruction of an array.
maybe there's a different use of this operator that I don't know about in a newer version of js?
what's the intended behavior of these two lines?
full stack trace:
/path/node_modules/winston-redis/lib/winston-redis.js:84
const { level, message, ...winstonMeta } = info
^^^
SyntaxError: Unexpected token ...
at createScript (vm.js:53:10)
at Object.runInThisContext (vm.js:95:10)
at Module._compile (module.js:543:28)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/path/utils/logger.js:2:1)
@indexzero @chjj can you guys take a look at master and see about releasing this to npm? Any thoughts on versioning? It should be backwards compatible with v1.0, however, I've moved winston and redis into peerDependencies. So I'm not sure if that would be considered a breaking change.
Hi,
I'm trying to use winston with winston-redis. This is the first time I use winston. This is my code:
var winston = require('winston')
require('winston-redis')
winston.add(winston.transports.Redis)
winston.log('info', 'foo')
There is no error. But if I go to redis-cli and type "lrange winston 0 -1" this is the output
1) "undefined: undefined"
I'm using winston 0.5.3 and redis-winston 0.1.0
Thanks.
For example this line is not published:
https://github.com/winstonjs/winston-redis/blob/master/lib/winston-redis.js#L104
Could you publish the current version to npm please?
using:
[email protected]
node v8.11.1
should be
const winston = require('winston');
const Redis = require('winston-redis');
winston.add(new Redis);
in the file in which you create your winston logger
I have node 6.11.2 installed and winston redis as show in npm list is installed with version 1.0.0. When i require it in code, it is still not working and throws not found module.
Hi,
After installing winston-redis
via npm I'm receiving the following warning:
npm WARN engine [email protected]: wanted: {"node":"0.8.x || 0.11.x"} (current: {"node":"0.10.33","npm":"2.1.11"})
I know it's not a big issue but perhaps this needs updating. Version 0.8 of node was released nearly 2 years ago. Same issue with npm - some major updates have been included.
Is there any support for error handling when a redis instance is not available? Currently the transport will just hang until it crashes. We want to use it as a transport in cases where the redis broker for messages is available and accepting messages, but not have the app crash if its unavailable or goes away while things are running. I can't really find a good solution of allowing this.
It looks like the transport doesn't quite fit my requirements of pushing three (at this stage) types of data:
All of which will be sent on three different channels minimum at different times, in the form of:
{ id: update.timestamp, event: update.event, data: update.data }
which is consumed by subscribbers converting the messages into server sent events (SSE) (AKA EventSource) to be sent to a CLI somewhere on the internet.
Originally posted by @binarymist in #29 (comment)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.