chromium/components/media_router/common/mojom/logger.mojom

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module media_router.mojom;

enum LogCategory {
  kDiscovery,
  kRoute,
  kMirroring,
  kUi,
};

// Collects logs from Media Router components such as Media Route Providers.
// The implementation lives in the browser process.
interface Logger {
  // Records a log entry of "info" severity. The severities are "info",
  // "warning", and "error" in increasing order.
  // |component|: This is usually the name of the class that is emitting the
  //     log, such as "CastSessionTracker".
  // |message|: The log message.
  // |sink_id|: ID of the media sink associated with this log. May be empty if
  //     the log is not associated with a sink.
  // |media_source|: ID of the media source, which may be of the format
  //     "cast:ABCDEFGH?arg1=val1" (app ID and query params) for Cast sessions,
  //     or the receiver page URL in the case of presentations. May be empty.
  // |session_id|: ID of the Cast or presentation session associated with this
  //     log. May be empty.
  LogInfo(LogCategory category,
      string component,
      string message,
      string sink_id,
      string media_source,
      string session_id);

  // Records a log entry of "warning" severity.
  LogWarning(LogCategory category,
      string component,
      string message,
      string sink_id,
      string media_source,
      string session_id);

  // Records a log entry of "error" severity.
  LogError(LogCategory category,
      string component,
      string message,
      string sink_id,
      string media_source,
      string session_id);

  // Binds this logger to a new pending receiver, allowing any code with access
  // to a Logger to create a new receiver for it.
  BindReceiver(pending_receiver<Logger> receiver);
};