winston-cloudwatch
winston-cloudwatch copied to clipboard
Options should be optional
Currently if you do not provide options you will get "cannot get property level of undefined"
Coverage increased (+0.03%) to 93.617% when pulling acf3fd16f24ee887a70c33a16c2a757861fd8f51 on melbourne2991:patch-1 into ece0847c03e057b501f1dae01d62d59e92833095 on lazywithclass:master.
Could you please provide a code example showing in which case that error is shown?
winston.add(WinstonCloudWatch);
I see. Then I don't think the fix is to let someone add to winston a configuration that will surely not work, because it doesn't have any information on where to store logs.
What's your use case? Why would you need to be able to use this library without, for example, a log stream and a log group?
If you don't allow an empty object it fails but the error message is unclear and not relevant to the actual problem - "cannot get property level of undefined", when you do allow an empty object the code will fail when it tries to get logGroupName and the error is more relevant (something along the lines of "logGroupName" not defined). I was confused about "level" being undefined because the Readme says level defaults to "info". So I spent quite a bit of time trying to figure out what was wrong with my "level" when really the problem was that I was missing logGroupName and logStreamName.
Cool, looks like we're talking about validation. Thanks for the details, they're really helpful for me to understand what the problem is.
I think I would like to do some basic validation on the options, so that we check that at least logGroup and logStream are there.