streamdeck icon indicating copy to clipboard operation
streamdeck copied to clipboard

Logging not logging - cannot debug

Open cgdutoit opened this issue 1 year ago • 3 comments

In my plugin, I cannot see any of my logging or console output.

I have reviewed this issue: https://github.com/elgatosf/streamdeck/issues/74

My problem is the same but the solution isn't.

  1. I am able to see log files in the logs directory. They do update with system messages, but NOT my own messages
  2. I can see logs in both the chrome inspector and VS code debug console, they update with system messages but not my own messages

I have tried logging in my plugin in a number of ways:

console.log("my debug info")
steamDeck.logger.debug("debugging")
steamDeck.logger.error("debugging")

I also tried creating a new logger:

const logger = streamDeck.logger.createScope("diy")
logger.setLevel(LogLevel.DEBUG);
logger.debug("test"

In my plugin.ts I have: streamDeck.logger.setLevel(LogLevel.DEBUG);

The log files/vs code console updates with things like system events and actions:

{"event":"setTitle","context":"e689650cecacc8a2a579ae28d197cd9b","payload":{"title":"7"}}
index.js:202
{"action":"com.ubmm.lightsceneselector.diyselector","context":"e689650cecacc8a2a579ae28d197cd9b","device":"49DE2ABDB6EF0B53B744A8B252ACE117","event":"keyUp","payload":{"coordinates":{"column":3,"row":0},"isInMultiAction":false,"settings":{"DSN":"7"}}}

But for the life of me, none of my debug statements appear.

I've restarted the plugin in terminal, I've restarted the streamdeck, readded the control etc. Nothing. My logs simply don't show up.

Help would be appreciated as it's almost impossible to develop a plugin without being able to debug.

Thanks for any advice

cgdutoit avatar Jan 11 '25 17:01 cgdutoit

Hi @cgdutoit,

Could you please share any logs that Stream Deck provides? These logs exist in /Users/<USERNAME>/Library/Logs/ElgatoStreamDeck on macOS and C:\Users\<USERNAME>\AppData\Roaming\Elgato\StreamDeck\logs on Windows (file name of StreamDeck<#>.log). This could tell us if the plugin is crashing or give more insight as to what is going on.

Is your plugin open source or could you share your plugin.ts file? I'm not experiencing the issue on my side, so debugging without some more information is difficult.

ChekTek avatar Jan 17 '25 20:01 ChekTek

I would like to add to this that my expectation was that Stream Deck SDK would log directly onto the terminal in which I ran:

$ npm run watch

Yet all I ever see is only:

rollup v4.34.9
bundles src/plugin.ts → com.philipp-kretzschmar.aleaiactaest.sdPlugin/bin/plugin.js...
created com.philipp-kretzschmar.aleaiactaest.sdPlugin/bin/plugin.js in 376ms
watch.onEnd $ streamdeck restart com.philipp-kretzschmar.aleaiactaest
√ Restarted com.philipp-kretzschmar.aleaiactaest

[2025-03-06 14:01:30] waiting for changes...

I first tried adding further console.log, I then tried adding some streamDeck.logger.info calls directly in the plugin.ts.

Yet no success:

import streamDeck, {LogLevel} from "@elgato/streamdeck";

import {Die} from "./actions/die";

console.log('Hello World via Console Log!');

streamDeck.logger.setLevel(LogLevel.TRACE);
streamDeck.actions.registerAction(new Die());
streamDeck.logger.info('Hello World via Streamdeck Logger!');

streamDeck.connect();

Digging through the docs, I then realized that the logs are written into the my-plugin\com.__MY_NAMESPACE__.__MY_PLUGIN_NAME__.sdPlugin\logs\ directory and that always the *.0.log` is the most recent log file. That is ok, albeit a bit much. When developing, I mostly care about the current log. The old logs are just noise.

What I wish for:

  • I don't want to setup a log-tail. The log should be printed in the npm run watch terminal as a sensible default for development.
    • add an option to toggle log onto terminal
  • either:
    • have console.log calls still be part of the logfile
    • throw on usage of console.log within the plugin's scope
    • overwrite console loggings methods, e.g. log, info, error, etc. pp. with your own logger so that it does not matter if one uses console.{log,info,error,debug, ...} or streamDeck.logger.{info,error,debug,...};
  • add an option to prevent file output and have terminal only
  • add an option to have a single file log only
  • add an option for single file logs to be replaced or appended

Not sure if this is still withing scope of this issue or if I should open a new one. (This is the first search result when I was having trouble getting logs to appear.)

k0pernikus avatar Mar 06 '25 13:03 k0pernikus

@k0pernikus You can always wrap the logger to log to anywhere you like (see the comments here):

https://github.com/elgatosf/streamdeck/issues/74#issuecomment-2498611525

tiptronic avatar Mar 06 '25 17:03 tiptronic

This issue was closed because it has been inactive for one week since being marked as stale.

github-actions[bot] avatar May 13 '25 02:05 github-actions[bot]