Skip to content

Accept subscriptions #4

@JesusTheHun

Description

@JesusTheHun

This lib is great for other libs because it is minimal, there is nothing to learn.

I maintain a few packages, some with IO, like database IO.
I use @open-draft/logger and I would like the consumer of my lib to be able to receive its logs, like database query.
But you don't want to handle every logging logic, there are great libs out there for that.

If one could just subscribe(fn), it would allow consumers to plugin in their own solution, without us, maintainers having to manage anything.

// lib.ts
const logger = new Logger('someLib');
export const onSomeLibLog = logger.subscribe;

// app.ts
import { onSomeLibLog } from 'someLib';

onSomeLibLog(log => {
  appLogSolution.write(log);
})

I'm willing to submit a PR for that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions