mperdeck / jsnlog.js

Tiny JavaScript logging library, simple and well documented. Lots of options to filter logging data.
js.jsnlog.com
Other
130 stars 43 forks source link

Custom appender #70

Open atao60 opened 6 years ago

atao60 commented 6 years ago

I'm trying to use jsnlog with Meteor + Angular 2. In the long term it'll be a server side rendering app.: the SSR proxy could be used to catch requests on 'options.url'. But ATM I want to avoid such a proxy. I.e. to stay using Meteor.methods/.call.

I'have a working workaround written in TS with a customized Ajax appender through JL.defaultBeforeSend, but it's quite contrived.

Things could be much more simple if some parts of jsnlog were public, at least:

I know you "never expected anybody to want to write a client side custom appender that lives outside jsnlog.ts" but is it something that you can consider?

mperdeck commented 6 years ago

Appender is already exported from the JL module, but it is not in the jl.d.ts file. Is the problem that it is not in jl.d.ts?

Are you saying it would help if I made the levelToString function public?

You can use Winston transports as appenders in jsnlog.js. Would it be easier to write your own Winston transport and use that as the appender?

atao60 commented 6 years ago

Is the problem that it is not in jl.d.ts?

Yes

Are you saying it would help if I made the levelToString function public?

Yes, it's OK with the levelToString function.

to write your own Winston transport

ATM I try to use as few libraries as possible. But why not. Even if I have no clue how to do it... I have never worked with Winston.

And thanks for such a useful library as jsnlog

atao60 commented 6 years ago

About Winston

Correct me if I'm wrong: Winston works only on the server side. jsnlog uses it to manage the storage devices.

My goal is to use meteor DDP protocol between client and server. Ie no Ajax, no dedicated url.