MCPcopy
hub / github.com/homebridge/homebridge / printCharacteristicWriteWarning

Method printCharacteristicWriteWarning

src/bridgeService.ts:307–336  ·  view source on GitHub ↗
(plugin: Plugin, accessory: Accessory, opts: CharacteristicWarningOpts, warning: CharacteristicWarning)

Source from the content-addressed store, hash-verified

305
306 // characteristic warning event has additional parameter originatorChain: string[] which is currently unused
307 public static printCharacteristicWriteWarning(plugin: Plugin, accessory: Accessory, opts: CharacteristicWarningOpts, warning: CharacteristicWarning): void {
308 const wikiInfo = 'See https://homebridge.io/w/JtMGR for more info.'
309 switch (warning.type) {
310 case CharacteristicWarningType.SLOW_READ:
311 case CharacteristicWarningType.SLOW_WRITE:
312 if (!opts.ignoreSlow) {
313 log.info(getLogPrefix(plugin.getPluginIdentifier()), 'This plugin slows down Homebridge.', warning.message, wikiInfo)
314 }
315 break
316 case CharacteristicWarningType.TIMEOUT_READ:
317 case CharacteristicWarningType.TIMEOUT_WRITE:
318 log.error(getLogPrefix(plugin.getPluginIdentifier()), 'This plugin slows down Homebridge.', warning.message, wikiInfo)
319 break
320 case CharacteristicWarningType.WARN_MESSAGE:
321 log.info(getLogPrefix(plugin.getPluginIdentifier()), `This plugin generated a warning from the characteristic '${warning.characteristic.displayName}':`, `${warning.message}.`, wikiInfo)
322 break
323 case CharacteristicWarningType.ERROR_MESSAGE:
324 log.error(getLogPrefix(plugin.getPluginIdentifier()), `This plugin threw an error from the characteristic '${warning.characteristic.displayName}':`, `${warning.message}.`, wikiInfo)
325 break
326 case CharacteristicWarningType.DEBUG_MESSAGE:
327 log.debug(getLogPrefix(plugin.getPluginIdentifier()), `Characteristic '${warning.characteristic.displayName}':`, `${warning.message}.`, wikiInfo)
328 break
329 default: // generic message for yet unknown types
330 log.info(getLogPrefix(plugin.getPluginIdentifier()), `This plugin generated a warning from the characteristic '${warning.characteristic.displayName}':`, `${warning.message}.`, wikiInfo)
331 break
332 }
333 if (warning.stack) {
334 log.debug(getLogPrefix(plugin.getPluginIdentifier()), warning.stack)
335 }
336 }
337
338 public publishBridge(): void {
339 const bridgeConfig = this.bridgeConfig

Callers 1

Calls 5

getLogPrefixFunction · 0.85
infoMethod · 0.80
errorMethod · 0.80
debugMethod · 0.80
getPluginIdentifierMethod · 0.45

Tested by

no test coverage detected