constructor(sharedConfig, context) {
    /**
     * @type {SharedLoggerConfig}
     * IMPORTANT: all instances of {@link DetoxLogger} must share the same object instance of this._sharedConfig.
     */
    this._sharedConfig = sharedConfig;

    /** @type {object | undefined} */
    this._context = context;

    /** @public */
    this.fatal = this._setupLogMethod('fatal');
    /** @public */
    this.error = this._setupLogMethod('error');
    /** @public */
    this.warn = this._setupLogMethod('warn');
    /** @public */
    this.info = this._setupLogMethod('info');
    /** @public */
    this.debug = this._setupLogMethod('debug');
    /** @public */
    this.trace = this._setupLogMethod('trace');

    if (!context) {
      // In this branch, `this` refers to the first (root) logger instance.

      this._sharedConfig.userConfig = this._sharedConfig.userConfig || {
        level: 'info',
        overrideConsole: false,
        options: {
          showDate: false,
          showLoggerName: false,
          showProcess: false,
          showPid: false,
          showLevel: false,
          showPrefixes: false,
          showMetadata: false,
        },
      };

      this._sharedConfig.bunyan = new BunyanLogger()
        .installFileStream(this.file)
        .installDebugStream(this.config);

      this._sharedConfig.dispatcher = new CategoryThreadDispatcher();
      this._sharedConfig.messageStack = new MessageStack();

      this.overrideConsole();
    }
  }
@param {SharedLoggerConfig} sharedConfig
@param {object} [context]