EffDioLogger.compat constructor

EffDioLogger.compat({
  1. bool request = true,
  2. bool requestHeader = false,
  3. bool requestBody = false,
  4. bool responseHeader = false,
  5. bool responseBody = true,
  6. bool error = true,
  7. bool filter(
    1. RequestOptions options,
    2. FilterArgs args
    )?,
  8. int lineWidth = 162,
  9. int? maxWidth = 324,
  10. bool compact = true,
  11. bool prettyJson = false,
  12. void logPrint(
    1. Object object
    )?,
  13. String logLineBreak = '\n',
  14. bool enabled = true,
  15. String? reqExtra(
    1. RequestOptions req
    )?,
  16. String? rspExtra(
    1. Response rsp
    )?,
  17. String? errExtra(
    1. DioException err
    )?,
})

兼容 EfficientDioLogger 默认构造的输出行为.

prettyJson is still opt-in here, so compat mode keeps the previous single-line output unless it is explicitly enabled.

Example: EffDioLogger.compat(prettyJson: true, compact: false, maxWidth: null)

Implementation

EffDioLogger.compat({
  this.request = true,
  this.requestHeader = false,
  this.requestBody = false,
  this.responseHeader = false,
  this.responseBody = true,
  this.error = true,
  this.filter,
  this.lineWidth = 162,
  this.maxWidth = 324,
  this.compact = true,
  this.prettyJson = false,
  void Function(Object object)? logPrint,
  this.logLineBreak = '\n',
  this.enabled = true,
  this.reqExtra,
  this.rspExtra,
  this.errExtra,
})  : _mode = _EffDioLoggerMode.compat,
      logPrint = (logPrint ?? Logger('EffLogger').info);