sidhantpanda / logt

🖥️ A colourful logger for the browser
https://sidhantpanda.github.io/logt/dist/
MIT License
193 stars 1 forks source link

Universal support (browser + server) #5

Open Vadorequest opened 3 years ago

Vadorequest commented 3 years ago

Is your feature request related to a problem? Please describe. Currently, the logt utility seems to be only available in the browser. Some functions like readConsole seem to target the browser console global object. It is unclear if it's usable on the server.

Is this tool usable for the server side too? Is it universal?

Also, how do you specify the "filename" in the below screenshot? (taken from your twitter post) image

Is it done manually, is it automated?

sidhantpanda commented 3 years ago

Hey @Vadorequest LogT is currently only available for browsers as colorizing terminal outputs requires separate work.

Can extend it to work in servers as well, if I get the time :)

Vadorequest commented 3 years ago

Thank you.

I'm currently trying to figure out which logger I should incorporate to Next Right Now. I'm currently considering both LogT and ulog. Have you heard of the latter?

Also, could you share an example about how you did the main.xs to be blue in the above screenshot?

My goal is to log the level/time/filename and the message(s) with an API that is consistent with the console native object (both on Client and Server).

sidhantpanda commented 3 years ago

The label in blue is the LOG_TAG. Achieved here with :

logger.info("main.xs", "example info");
sidhantpanda commented 3 years ago

Had not heard of ulog before. Checked it out, their library size is ~2.8kb when bundled. But the added bloat might be unnecessary to ship to the frontend.

It might be better to have a separate library for backend, if you care about that kind of optimisation. Might be better to write a new library logt-server that caters to purely backend, and adheres to the exact same class definitions.