8000 Use js-logger as global variable method like console.log · Issue #116 · jonnyreeves/js-logger · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Use js-logger as global variable method like console.log #116
Open
@christianstamati

Description

@christianstamati

Hello!
I am developing an app in Next.js and I started adopting this library because I like the way it handles the LOG_LEVELES.
In my project i just created a file logger.ts and added the js-logger export like so:

import jsLogger from "js-logger";
jsLogger.useDefaults();
const logger = jsLogger;
export default logger;

so in my code I can use it like this:

import logger from "@/lib/logger";
logger.log("Hello!");

This works perfectly but I would like to know if we can use it like console.log wirhout importing it in every file. And since I use it to log stuff on server-side and client side (Browser) It should work on both.

I achieved this on client side but on server-side is not working... Is there a way to achieve this? wrap somehow the js-logger library and use it on server side and client side (browser) without importing logger on each file?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0