Comments (3)
Hey 👋🏻 thank you so much for the issue (and fulfilling a PR) 💯
You raise a few good points,
print all messages from all loggers above a certain loglevel
Yeah the way I use it is almost exactly how you're describing in your PR, with the compare
method in the onEmit
. Should actually document that one 😅. And ya probably not the best DX to introduce that, especially if youre just wanting the default reporter.
The inheritance is a great idea! Not quite how I had envisioned it, my idea was consumers create their own createLogger
function:
const onEmit = () => { ... };
export const createLogger = (name) => diarty(name, onEmit);
that way you can share the onEmit no problems — seeing as we're JavaScript, we typically scope loggers to a package. But ya if we want that rust
vibe, abc:123:xyz
(like I originally wanted), then yeah we need something to "extend/share".
So with that, thank you so much for the PR — will comment over there as well, you did docs, tests and code. Might amend it a little, just think if the :
is a good separator we can enforce. Or if .diary
is better/worse than .chapter
— you know, "dear diary, today I x. Chapter 2, then I y", this a story telling logger.
Is any of this a blocker for you right now? Might leave it with my brain for a day. Also keen to get more of an insight to how youre using it, keen to jump on a call?
from diary.
yeah I totally missed that trick to just make a custom createLogger :D I think that basically covers my entire usecase now that I think about it, the inherited diary names is not something I really need. Would be a good idea to add that example to the docs in any case since I expect this usecase to come up quite a lot
As for the scope inheritance, I do quite like idea of it. Not sure how useful it will be in practice (going too heavy on the inheritance might actually hurt useability, and might discourage topic-based diaries) but it's a style that other loggers (e.g. loglevel ) seem to do as well so it feels quite natural.
Not sure about the diary.chapter
syntax. It reads nicely, but how do you continue? diary.chapter.paragraph
? and after that you kind of run out of words. It could be a conscious design decision to limit the amount of inheritance, but at that point I think I'd prefer no inheritance at all to avoid confusion.
None of this is really blocking for me, especially now that I see how I can share the onEmit
without it.
I am available for a call if you'd like. My timezone is GMT+1 and I tend to be mentally available between 9:00 and 23:00
but practical considerations get in the way of course. This week especially is chaotic, wednesday or thursday will probably work out though.
from diary.
Hi @abeforgit thank you for your 3 year patience here with this. Going to close this issue as not planned 💕 thank you for being a loyal user all these years!
from diary.
Related Issues (14)
- TypeScript: Cannot find module 'diary' or its corresponding type declarations HOT 7
- [Feature] Allow logging of arbitrary object without message HOT 7
- [Bug] Handle cases where localStorage is not available. HOT 3
- Support `deno`
- Separate setup from logging in benchmarks HOT 4
- `LogFnAsError` type missing from `src/index.d.ts` HOT 3
- Trying to access process.env HOT 2
- Add check to filter log level HOT 2
- Add in a json logger as an extra
- Build babel plugin to enhance context HOT 3
- Consider anylogger support? HOT 4
- [RFC] Always "log" just don't output HOT 1
- TypeScript: Cannot find module 'diary' or its corresponding type declarations HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from diary.