download / anylogger Goto Github PK
View Code? Open in Web Editor NEWGet a logger. Any logger.
License: MIT License
Get a logger. Any logger.
License: MIT License
I've implemented anylogger
in a library I'm authoring in TypeScript. Unfortunately, the anylogger instance in my library is never updated by any adapters I try to use in an application (also TypeScript) that uses this library, so no logging in my library ever appears in the application's console output.
To keep things simple I'm using import 'anylogger-console'
in the application that's consuming my library, but I also have this issue when I try with ulog
.
I've created a repo reproducing the issue. The README.md file within contains basic reproduction steps:
In the https://github.com/download/anylogger#install instructions, everything is written for NPM and server side javascript. However, I'm using browser side Javascript and am a complete javascript newb, so I'm essentially using jQuery and nothing else.
How do I get anylogger set up and running with either debug or ulog?
Hello. I noticed that with latest typescript, using moduleResolution: "Node16"
, the package stops working because it is not an ESM package (no type: "module"
) but the type declaration represents a module export default anylogger
I might propose to simply change that to export = anylogger
but given that the source itself is written as a module and even bundled in the package, I might propose actually going for a "proper" dual package.
@jirutka
I added a method enabledFor
to all loggers. I edited the typescript definition you created to the best of my ability, but I've never actually used Typescript, so could you have a look maybe and tell me if I did the right thing or not? Thanks for your help so far on this.
I do the the following in my webapp index.js
import ulog from 'ulog';
// import anylogger from 'anylogger';
// anylogger('app:home');
ulog.disable('app:*');
and then in my home page
import anylogger from 'anylogger';
const log = anylogger('app:home');
log.info('Anylogger is easy!');
if I leave the commented line commented, the log will appear, even though I wanted to disable all of them
If I instead comment out the 2 lines, it works as intended.
Unfortunately this won't work if I use query string and it is also a shame to have to declare all loggers before hand
I got an error in this line:
https://github.com/Download/anylogger/blob/master/anylogger.js#L72
Can you please make an NPM release?
OT: I'm (err, I was) a huge fan of AnyEvent
in the Perl ecosystem. Were you inspired by it?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.