Use logger module for shim logging

This commit is contained in:
hensm
2020-01-26 16:10:08 +00:00
parent c676184898
commit 7efcbcde8f
8 changed files with 75 additions and 59 deletions

View File

@@ -1,5 +1,8 @@
"use strict";
import logger from "../../lib/logger";
/**
* Custom element for a cast button used by sites that injects
* a cast icon and manages visibility state and event handling.
@@ -72,7 +75,7 @@ export default class GoogleCastLauncher extends HTMLElement {
this.addEventListener("click", () => {
console.info("<google-cast-launcher> onClick");
logger.info("<google-cast-launcher> onClick");
});
}
}

View File

@@ -1,36 +1,38 @@
"use strict";
import logger from "../../../lib/logger";
import CastOptions from "./CastOptions";
import CastSession from "./CastSession";
export default class CastContext extends EventTarget {
public endCurrentSession (_stopCasting: boolean): void {
console.info("STUB :: CastContext#endCurrentSession");
logger.info("STUB :: CastContext#endCurrentSession");
}
// @ts-ignore
public getCastState (): string {
console.info("STUB :: CastContext#getCastState");
logger.info("STUB :: CastContext#getCastState");
}
// @ts-ignore
public getCurrentSession (): CastSession {
console.info("STUB :: CastContext#getCurrentSession");
logger.info("STUB :: CastContext#getCurrentSession");
}
// @ts-ignore
public getSessionState (): string {
console.info("STUB :: CastContext#getSessionState");
logger.info("STUB :: CastContext#getSessionState");
}
// @ts-ignore
public requestSession (): Promise<string> {
console.info("STUB :: CastContext#requestSession");
logger.info("STUB :: CastContext#requestSession");
}
public setOptions (_options: CastOptions): void {
console.info("STUB :: CastContext#setOptions");
logger.info("STUB :: CastContext#setOptions");
}
}

View File

@@ -1,5 +1,7 @@
"use strict";
import logger from "../../../lib/logger";
import * as cast from "../../cast";
import ApplicationMetadata from "./ApplicationMetadata";
@@ -11,80 +13,80 @@ type MessageListener = (namespace: string, message: string) => void;
export default class CastSession extends EventTarget {
constructor (_sessionObj: cast.Session, _state: string) {
super();
console.info("STUB :: CastSession#constructor");
logger.info("STUB :: CastSession#constructor");
}
public addMessageListener (
_namespace: string
, _listener: MessageListener): void {
console.info("STUB :: CastSession#addMessageListener");
logger.info("STUB :: CastSession#addMessageListener");
}
public endSession (_stopCasting: boolean): void {
console.info("STUB :: CastSession#endSession");
logger.info("STUB :: CastSession#endSession");
}
// @ts-ignore
public getActiveInputState (): number {
console.info("STUB :: CastSession#getActiveInputState");
logger.info("STUB :: CastSession#getActiveInputState");
}
// @ts-ignore
public getApplicationMetadata (): ApplicationMetadata {
console.info("STUB :: CastSession#getApplicationMetadata");
logger.info("STUB :: CastSession#getApplicationMetadata");
}
// @ts-ignore
public getApplicationStatus (): string {
console.info("STUB :: CastSession#getApplicationStatus");
logger.info("STUB :: CastSession#getApplicationStatus");
}
// @ts-ignore
public getCastDevice (): cast.Receiver {
console.info("STUB :: CastSession#getCastDevice");
logger.info("STUB :: CastSession#getCastDevice");
}
// @ts-ignore
public getMediaSession (): cast.media.Media {
console.info("STUB :: CastSession#getMediaSession");
logger.info("STUB :: CastSession#getMediaSession");
}
// @ts-ignore
public getSessionId (): string {
console.info("STUB :: CastSession#getSessionId");
logger.info("STUB :: CastSession#getSessionId");
}
// @ts-ignore
public getSessionObj (): cast.Session {
console.info("STUB :: CastSession#getSessionObj");
logger.info("STUB :: CastSession#getSessionObj");
}
// @ts-ignore
public getSessionState (): string {
console.info("STUB :: CastSession#getSessionState");
logger.info("STUB :: CastSession#getSessionState");
}
// @ts-ignore
public getVolume (): number {
console.info("STUB :: CastSession#getVolume");
logger.info("STUB :: CastSession#getVolume");
}
// @ts-ignore
public isMute (): boolean {
console.info("STUB :: CastSession#isMute");
logger.info("STUB :: CastSession#isMute");
}
// @ts-ignore
public loadMedia (_loadRequest: cast.media.LoadRequest): Promise<string> {
console.info("STUB :: CastSession#loadMedia");
logger.info("STUB :: CastSession#loadMedia");
}
public removeMessageListener (
_namespace: string
, _listener: MessageListener): void {
console.info("STUB :: CastSession#removeMessageListener");
logger.info("STUB :: CastSession#removeMessageListener");
}
public sendMessage (
@@ -92,16 +94,16 @@ export default class CastSession extends EventTarget {
// @ts-ignore
, _data: any): Promise<string> {
console.info("STUB :: CastSession#sendMessage");
logger.info("STUB :: CastSession#sendMessage");
}
// @ts-ignore
public setMute (_isMute: boolean): Promise<string> {
console.info("STUB :: CastSession#setMute");
logger.info("STUB :: CastSession#setMute");
}
// @ts-ignore
public setVolume (_volume: number): Promise<string> {
console.info("STUB :: CastSession#setVolume");
logger.info("STUB :: CastSession#setVolume");
}
}

View File

@@ -1,12 +1,14 @@
"use strict";
import logger from "../../../lib/logger";
import RemotePlayer from "./RemotePlayer";
export default class RemotePlayerController extends EventTarget {
constructor (_player: RemotePlayer) {
super();
console.info("STUB :: RemotePlayerController#constructor");
logger.info("STUB :: RemotePlayerController#constructor");
}
public getFormattedTime (timeInSec: number): string {
@@ -28,22 +30,22 @@ export default class RemotePlayerController extends EventTarget {
}
public muteOrUnmute (): void {
console.info("STUB :: RemotePlayerController#muteOrUnmute");
logger.info("STUB :: RemotePlayerController#muteOrUnmute");
}
public playOrPause (): void {
console.info("STUB :: RemotePlayerController#playOrPause");
logger.info("STUB :: RemotePlayerController#playOrPause");
}
public seek (): void {
console.info("STUB :: RemotePlayerController#seek");
logger.info("STUB :: RemotePlayerController#seek");
}
public setVolumeLevel (): void {
console.info("STUB :: RemotePlayerController#setVolumeLevel");
logger.info("STUB :: RemotePlayerController#setVolumeLevel");
}
public stop (): void {
console.info("STUB :: RemotePlayerController#stop");
logger.info("STUB :: RemotePlayerController#stop");
}
}

View File

@@ -1,5 +1,6 @@
"use strict";
import logger from "../../lib/logger";
import ActiveInputStateEventData from "./classes/ActiveInputStateEventData";
import ApplicationMetadata from "./classes/ApplicationMetadata";
@@ -55,7 +56,7 @@ export default {
, VERSION: "1.0.07"
, setLoggerLevel (_level: number) {
console.info("STUB :: cast.framework.setLoggerLevel");
logger.info("STUB :: cast.framework.setLoggerLevel");
}
};