Replace remaining console calls with logger calls

This commit is contained in:
hensm
2020-01-23 01:14:57 +00:00
parent 7f84b90431
commit f6e09ca687
8 changed files with 46 additions and 27 deletions

View File

@@ -45,7 +45,7 @@ browser.runtime.onInstalled.addListener(async details => {
function initBrowserAction () {
console.info("fx_cast (Debug): init (browser action)");
logger.info("init (browser action)");
/*browser.browserAction.disable();
@@ -86,7 +86,7 @@ function initBrowserAction () {
async function initMenus () {
console.info("fx_cast (Debug): init (menus)");
logger.info("init (menus)");
const URL_PATTERN_HTTP = "http://*/*";
const URL_PATTERN_HTTPS = "https://*/*";
@@ -413,7 +413,7 @@ async function initMenus () {
async function initRequestListener () {
console.info("fx_cast (Debug): init (request listener)");
logger.info("init (request listener)");
type OnBeforeRequestDetails = Parameters<Parameters<
typeof browser.webRequest.onBeforeRequest.addListener>[0]>[0];
@@ -457,7 +457,7 @@ async function initRequestListener () {
function initWhitelist () {
console.info("fx_cast (Debug): init (whitelist)");
logger.info("init (whitelist)");
type OnBeforeSendHeadersDetails = Parameters<Parameters<
typeof browser.webRequest.onBeforeSendHeaders.addListener>[0]>[0];
@@ -536,7 +536,7 @@ function initWhitelist () {
async function initMediaOverlay () {
console.info("fx_cast (Debug): init (media overlay)");
logger.info("init (media overlay)");
let contentScript: browser.contentScripts.RegisteredContentScript;
@@ -553,7 +553,7 @@ async function initMediaOverlay () {
, runAt: "document_start"
});
} catch (err) {
console.error("fx_cast (Debug): Failed to register media overlay");
logger.error("Failed to register media overlay")
}
}
@@ -591,7 +591,7 @@ async function init () {
return;
}
console.info("fx_cast (Debug): init");
logger.info("init");
isInitialized = true;

View File

@@ -2,6 +2,7 @@
import bridge from "../../lib/bridge";
import knownApps from "../../lib/knownApps";
import logger from "../../lib/logger";
import options from "../../lib/options";
import { TypedEventTarget } from "../../lib/typedEvents";
@@ -145,8 +146,7 @@ export default class NativeReceiverSelector
private async onBridgePortMessageError (
message: NativeReceiverSelectorErrorMessage) {
console.error("fx_cast (Debug): Native receiver selector error"
, message.data);
logger.error("Native receiver selector error", message.data);
this.dispatchEvent(new CustomEvent("error"));
}

View File

@@ -90,7 +90,7 @@ async function getSelection (
availableMediaTypes = getMediaTypesForPageUrl(url);
} catch (err) {
console.error("fx_cast (Debug): Failed to locate frame");
logger.error("Failed to locate frame");
reject();
return;
}
@@ -136,25 +136,25 @@ async function getSelection (
}
function onSelected (ev: any) {
console.info("fx_cast (Debug): Selected receiver", ev.detail);
logger.info("Selected receiver", ev.detail);
resolve(ev.detail);
removeListeners();
}
function onCancelled () {
console.info("fx_cast (Debug): Cancelled receiver selection");
logger.info("Cancelled receiver selection");
resolve(null);
removeListeners();
}
function onError () {
console.error("fx_cast (Debug): Failed to select receiver");
logger.error("Failed to select receiver");
reject();
removeListeners();
}
function onStop (ev: any) {
console.info("fx_cast (Debug): Stopped receiver app", ev.detail);
logger.info("Stopped receiver app", ev.detail);
StatusManager.init().then(() => {
StatusManager.stopReceiverApp(ev.detail.receiver);