basic.mjs 734 B

123456789101112131415161718192021222324
  1. import { LogLevels, createConsola as createConsola$1 } from './core.mjs';
  2. export { Consola, LogTypes } from './core.mjs';
  3. import { B as BasicReporter } from './shared/consola.06ad8a64.mjs';
  4. import 'node:util';
  5. import 'node:path';
  6. function createConsola(options = {}) {
  7. let level = LogLevels.info;
  8. if (process.env.CONSOLA_LEVEL) {
  9. level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;
  10. }
  11. const consola2 = createConsola$1({
  12. level,
  13. defaults: { level },
  14. stdout: process.stdout,
  15. stderr: process.stderr,
  16. reporters: options.reporters || [new BasicReporter()],
  17. ...options
  18. });
  19. return consola2;
  20. }
  21. const consola = createConsola();
  22. export { LogLevels, consola, createConsola, consola as default };