Console Logger
A plugin to easily enable logs to be written to the JS console. Extremely helpful for local Player development and debugging.
Install the plugin:
import { Player } from "@player-ui/player";import { ConsoleLoggerPlugin } from "@player-ui/console-logger-plugin";
const consoleLogger = new ConsoleLoggerPlugin();
const player = new Player({ plugins: [consoleLogger],});To change the severity:
consoleLogger.setSeverity("warn");CocoaPods
Add the subspec to your Podfile.
pod 'PlayerUI/PrintLoggerPlugin'In your Swift file, import the pod. Only one import is needed for all PlayerUI pods.
import PlayerUISwift Package Manager
Add the product to the appropriate target's dependencies in your Package.swift.
.target( name: "MyApp", dependencies: [ .product(name: "PlayerUIPrintLoggerPlugin", package: "playerui-swift-package"), ])In your Swift file, import the sub-package. A different import is needed for each PlayerUI sub-package.
import PlayerUIPrintLoggerPluginSwift Usage
Section titled “Swift Usage”var body: some View { SwiftUIPlayer( flow: flow, plugins: [ PrintLoggerPlugin() ], result: $resultBinding )}To change the severity, supply it as an argument to the constructor:
PrintLoggerPlugin(level: .warn)