Created
December 14, 2023 19:10
-
-
Save Mr0grog/0683970ae216da0dee76adba4be14fb7 to your computer and use it in GitHub Desktop.
Repro for Loglevel#187
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import log from 'loglevel'; | |
import logPrefix from 'loglevel-plugin-prefix'; | |
import { logFromA } from './module-a.js'; | |
import { logFromB } from './module-b.js'; | |
logPrefix.reg(log); | |
logPrefix.apply(log, { template: '[%t] %l %n:' }); | |
log.enableAll(); | |
// Comment out the imports at the top of the file and uncomment these to make | |
// things work like you probably expect! | |
// const logFromA = (await import('./module-a.js')).logFromA | |
// const logFromB = (await import('./module-b.js')).logFromB | |
log.warn('Warn at root!'); | |
log.info('Info at root!'); | |
logFromA(); | |
logFromB(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import log from 'loglevel'; | |
const logger = log.getLogger('ModuleA'); | |
export function logFromA() { | |
logger.warn('Warn from A!'); | |
logger.info('Info from A!'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import log from 'loglevel'; | |
const logger = log.getLogger('ModuleB'); | |
export function logFromB() { | |
logger.warn('Warn from B!'); | |
logger.info('Info from B!'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "test-187", | |
"version": "1.0.0", | |
"description": "Testing loglevel#187", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "MIT", | |
"dependencies": { | |
"loglevel": "^1.8.1", | |
"loglevel-plugin-prefix": "^0.8.4" | |
}, | |
"type": "module" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment