-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add loggly support #64
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #64 +/- ##
==========================================
- Coverage 74.66% 74.02% -0.64%
==========================================
Files 11 11
Lines 371 385 +14
==========================================
+ Hits 277 285 +8
- Misses 94 100 +6
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR
a couple of points
- It's better to keep this tool OS agnostic
- Add options to both
env
and .watch config - as you mentioned in point 2 let's use a general JSON-format since both graylogformat, and logglyformat are the same I can see that repeating for other services.
- Solve merge conflicts
- ES-lint
Other than that it will be a good addition
setLoggerLevel(logLevel); | ||
setLogglyTransport(logglyAccessToken, logglySubDomain, logglyTag); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we set a conditional check and only setLogglyTransport
when the output type is chosen as loggly
. as it doesn't make sense to always set it up
import { getCommandVars } from './command'; | ||
|
||
require('winston-loggly-bulk'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand that require
is more natively by node but let's stay with the code and use import
const loggerConsoleOptions = { | ||
timestamp: false, | ||
colorize: false, | ||
formatter: options => `${options.message}`, | ||
json: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What will happen if type of output chosen was terminal
?
transports: [ | ||
new (winston.transports.Console)(loggerConsoleOptions), | ||
] }); | ||
let logger; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it not constant?
|
||
export default (data, type = 'terminal') => { | ||
switch (type) { | ||
case 'terminal': | ||
logger.log('info', terminalFormat(data)); | ||
break; | ||
case 'graylog': | ||
logger.log('info', JSON.stringify(grayLogFromat(data.transaction, | ||
data.decodedInputDataResult, data.decodedLogs))); | ||
logger.log('info', grayLogFromat(data.transaction, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with your point, let's make them both jsonFormat
add loggly support using npm "winston-loggly-bulk"
NOTES
JSON is send to Loggly using winston transport, console transport still log using stringify (now an option in constructor)
Feedback welcome!