Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logger: refactor with configurable implemention #204

Open
myfreeer opened this issue Mar 18, 2021 · 1 comment
Open

logger: refactor with configurable implemention #204

myfreeer opened this issue Mar 18, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@myfreeer
Copy link
Member

myfreeer commented Mar 18, 2021

Currently we use log4js as the logger, but users may want to use other logging framework or implement logger themselves.

  • Loggers are initialized in the init life cycle of the main thread.
  • Logger should be returned by a function as implemention of interfaces.
  • Messages of the worker threads are sent to the main thread and logged by the worker of main thread.
  • Logger initializer should only be invoked in the main thread.
  • The dependency of log4js should probably removed with adapters, a default console-based implemention should be provided instead.
  • This change should be considered breaking.
export interface Logger {
    trace(type: LogType, ...contents: unknown[]): void;
    debug(type: LogType, ...contents: unknown[]): void;
    info(type: LogType, ...contents: unknown[]): void;
    warn(type: LogType, ...contents: unknown[]): void;
    error(type: LogType, ...contents: unknown[]): void;
}

LogType may include:

  • io
    • http
      • request
      • response
      • notFound
      • retry
    • disk
      • mkdir
  • system
    • skip
    • skipExternal
    • complete
    • adjustConcurrency
  • custom
@myfreeer myfreeer added the enhancement New feature or request label Mar 18, 2021
@myfreeer
Copy link
Member Author

Maybe after #102 we can make most of logging as optional listeners

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant