-
Notifications
You must be signed in to change notification settings - Fork 776
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
Import error when using ES6 module syntax #1063
Labels
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
Milestone
Comments
Also missing from log4js-api. |
any news here? |
Duplicate of #1009. |
I think this is a documentation issue. import { configure, getLogger } from "log4js";
configure("./filename");
const logger = getLogger();
logger.level = "debug";
logger.debug("Some debug messages");
configure({
appenders: { cheese: { type: "file", filename: "cheese.log" } },
categories: { default: { appenders: ["cheese"], level: "error" } }
}); I have the updated documentation below. Let me know if it works. import * as log4js from "log4js";
log4js.configure({
appenders: { cheese: { type: "file", filename: "cheese.log" } },
categories: { default: { appenders: ["cheese"], level: "error" } }
});
const logger = log4js.getLogger();
logger.level = "debug";
logger.debug("Some debug messages"); |
CJS const log4js = require('@log4js-node/log4js-api');
const logger = log4js.getLogger('my-library');
logger.info("Library starting up"); ESM import * as log4js from '@log4js-node/log4js-api';
const logger = log4js.getLogger('my-library');
logger.info("Library starting up"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
Since my project has enabled
"type": "module"
inpackage.json
, an error was thrown when I imported it.If I remove
"type": "module"
and use the CJS module, all modules in my project will need to be rewritten. Is there a good solution? thankThe following is the error message:
The text was updated successfully, but these errors were encountered: