tracehx
NB: This is not really ready for public use – the API will almost certainly change.
Perhaps useful as an example of how to customize the haxe trace function.
Simple enhanced tracing (JS browser target only)
- Provides access to different logging levels in the browser console
- Permits easy logging of multiple values via a single trace call
– Obviously all also available via Browser.console.log etc. but sometimes, in multi-target projects you want to use trace.
Usage
import tracehx.Trace;
import tracehx.LogLevel;
// execute once per application
TraceHx.init();
var s = "hello world";
var o = {prop1: "hello", prop2: "world"}
trace(s, o);
trace(s, o, LogLevel.error);
Configuration
You can show/hide meta data about each trace statement. And also style the output for each log level. These are the defaults:
TraceHx.init({
metaStyle: "color: lightgray",
infoStyle: "color: #339900",
errorStyle: "color: red",
debugStyle: "color: blue",
warnStyle: "color: orange",
defaultStyle: "color: #333333",
showMeta: true
});