useLogger method

void useLogger(
  1. void logger(
    1. Object?
    ), {
  2. bool withBody = false,
  3. bool withHeader = false,
})

Activate a logger. Typically used with a try/finally block, e.g.:

server.useLogger(print);
try {
  // do something eg. create a container, add a document, execute a query...
  // the request to CosmosDB will be logged
} finally {
  server.resetLogger();
}

Implementation

void useLogger(void Function(Object?) logger,
    {bool withBody = false, bool withHeader = false}) {
  final dbgClient = dbgHttpClient;
  if (dbgClient != null) {
    dbgClient.log = logger;
    dbgClient.trace = true;
    dbgClient.traceBody = withBody;
    dbgClient.traceHeaders = withHeader;
  }
}