logger-node icon indicating copy to clipboard operation
logger-node copied to clipboard

LogLevel undefined

Open mgummelt opened this issue 3 years ago • 2 comments

I just installed @logdna/logger, and am instantiating my logger as follows:

import logdna, { LogLevel } from "@logdna/logger";

const options = {
    app: "Rover",
    level: LogLevel.debug,
};

const logDNALogger = logdna.createLogger(<key>, options);

Then receiving the error:

**TypeError: Cannot read property 'debug' of undefined**

It doesn't seem the source provides any LogLevel variable, despite the TS types file advertising that it does.

mgummelt avatar Mar 24 '21 20:03 mgummelt

Yes, my code compiles fine with gulp, but when it's run with node, it fails. I use a string instead.

private logOptions: ConstructorOptions = {
    level: config.debug ? "debug" : "info",
};

xinthose avatar May 18 '22 19:05 xinthose

The intention was for it to be passed as a string, yes. This isn't a Typescript project, but we try to provide the typedefs as a convenience, albeit untested. If you see ways to improve it or fix bugs with those, please feel free to open a PR!

darinspivey avatar May 19 '22 23:05 darinspivey

Sorry that this is so grossly out of date. There is an incoming fix that was tested locally against the code provided in this issue.

darinspivey avatar Aug 15 '24 15:08 darinspivey

:tada: This issue has been resolved in version 2.6.11 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

logdnabot avatar Aug 16 '24 12:08 logdnabot