sidhantpanda/logt

Universal support (browser + server)

Opened this issue · 4 comments

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?

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 :)

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).

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

logger.info("main.xs", "example info");

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.