Don't see console.log output

• Mar 8, 2024 - 06:25

Hi, I'm trying to run a hello world plugin but don't see any console output. I'm checking in the %LOCALAPPDATA%\MuseScore\MuseScore4\logs directory.

This is the onRun code I'm trying:

    onRun: {
        console.log("Hello World!");
        quit();
    }

And this is the output I see in the latest file from the logs directory (my plugin is called "FLMScore"):

2024-03-07T22:11:02.678 | INFO  | main_thread     | ActionsDispatcher::dispatch | try call action: FLMScore

No "Hello World!" message.

Should I be looking somewhere else to see the effects of console.log?

Thanks for any help!


Comments

In reply to by amac_26629

In MU3.6 you can send output to a file (see MiniOutput.qml), but I don't know if this works in MU4, and that is more tedious and limited than console.log already is..
Always check https://musescore.org/en/plugins?category=All&compatibility=All for this kind of question.
There I found:
https://musescore.org/en/project/debugtools-using-log-file-debug-plugins
But I have not used it myself...

Attachment Size
MiniOutput.qml 920 bytes

I got basic file writing working after looking over some sample scripts. I don't think it's worth officially uploading my plugin in its current state, but I'll paste the "Hello World!" code here for anybody who stumble across this thread in the future:

import QtQuick 2.0
import MuseScore 3.0
import FileIO 3.0

MuseScore {
    title: "YourPluginTitle"
    description: "Description Goes Here"
    version: "4.0"

    FileIO {
            id: outfile
            source: "Z:/Path/To/Your/Output/Directory/MuseScoreScript.log"
            onError: console.log(msg)
    }  

    onRun:{
        var cursor = curScore.startCmd()
        var rc = outfile.write("Hello World!\n");
            if (rc){ 
                  console.log("Log file has been  written to "+ outfile.source);
            } else {
                  console.log("Something went wrong. File cannot be written");
            }
        quit();
    } 
}

Do you still have an unanswered question? Please log in first to post your question.