Feature request: Debug output

To prevent every other script from re-inventing the wheel:

Dopus.Output() only supports boolean errors. It'd be handy if we had an extended Dopus.Debug() (or sumsuch) for script debug output, maybe even for multiple levels of debugging like INFO, WARN, ERROR etc.
Inclusion of @debug for internal commands would be nice too :slight_smile:

I'm just not sure how the user would set the verbosity-level... Maybe a Dopus-wide setting somewhere? Anyone?

You already have Info and Error levels. Is a third level really needed for the type of script that runs in Opus, as a global setting rather than a per-script setting?

Most scripts don't output anything to the log at all unless there's an error or they have debugging switched on, which is how it should be IMO.

function log(level, str, color)
{
	if (Script.config['Log Level'] > 0)
	{
		if (color === undefined) color = '#8888ff';
		switch (Script.config['Log Level'])
		{
			case 1: if (level == 1 ) DOpus.Output('<font color=' + color + '>' + str + '</font>'); break;
			case 2: if (level <= 2 ) DOpus.Output('<font color=' + color + '>' + str + '</font>'); break;
			case 3: if (level <= 3 ) DOpus.Output('<font color=' + color + '>' + str + '</font>'); break;
		}
	}
	return;	
}

I know how to code a debug function. I just think it'd help if Dopus provided this.