Namespace: Konsole

Konsole

A on-screen debugger / default console replacement class


By default Konsole will take over your Browser default console.
You can prevent that by changing the Konsole.takeOver property.
See:

Members

staticKonsole.enabledBoolean

Boolean value indicating if Konsole logging is enabled or disabled.
If Konsole is in Takeover-Mode, this will also disable the browser default console logging.
Default Value:
  • true

staticKonsole.keystring

The Key to which Konsole should be bound. When pressed, the Konsole will either show or hide.
Default Value:
  • ยง

staticKonsole.maxLogDepthNumber

Defines the maximum depth that an object should be inspected. Default: 5
Default Value:
  • 5

staticKonsole.originalEnabledBoolean

If the default browser console should be logged to as well
Default Value:
  • true

staticKonsole.reportingEnabledBoolean

If Konsole Reporting is enabled or not. Default: false
Default Value:
  • false

staticKonsole.reportingUrlString

URL to KonsoleReporter
Default Value:
  • './konsolereport/log.php'

staticKonsole.showErrorsBoolean

Catch all Javascript errors and log them to Konsole
Default Value:
  • false

staticKonsole.snapString

Snap the Console to any of the four borders of the screen. Values are: top, right, bottom, left
Default Value:
  • top
Example
// Snaps the Konsole to the right of the browser
Konsole.snap = 'right';

staticKonsole.takeOverBoolean

Defines if Konsole shall act as the default console.
This allows you to use Konsole the same way you would use the regular console.
Caution:
More than likely Konsole will not feature all the methods that your regular console has.
You can however still use the regular console when this is enabled by calling it at _console.
Default Value:
  • true
Example
// Without Takeover
Konsole.takeOver = false;
Konsole.log("test"); // This is Konsole (duuh)
console.log("test"); // Your Browsers regular console

// WITH Takeover
Konsole.takeOver = true;
console.log("test"); // Konsole is now the default console
_console.log("test"); // This is the browser default console

staticKonsole.visibleBoolean

Boolean value indicating if the Konsole is visible or not. Can also be set to either hide or show the Konsole.
Default Value:
  • false
Example
// Displays the Konsole
Konsole.visible = true;
// Hides the Konsole
Konsole.visible = false;

Methods

staticKonsole.clear()

Clears the console

staticKonsole.createCommand(cmdName, cmdFunc, cmdHelp)

Create a Command/Function that can be called from the Konsole Input.
Name Type Description
cmdName String The name of the command
cmdFunc function The method/function that should be called
cmdHelp String optional A short documentation of the command you are adding
Example
var myFunction = function(str) {
    alert(str);
};
Konsole.createCommand("alert", myFunction, 'Display an alert window. Example: "alert hello world"');

staticKonsole.error(values)

Log an error message to the console
Name Type Description
values * repeatable . Can be any valid javascript object/type
Example
Konsole.error("myString", 5, true, [1,2,3,4], {myValue: "hello world"});

staticKonsole.event(values)

Log an event message to the console
Name Type Description
values * repeatable . Can be any valid javascript object/type
Example
Konsole.event("myString", 5, true, [1,2,3,4], {myValue: "hello world"});

staticKonsole.getStackLine(index)

Get Stack Line from where this function is called (filename, line, char index)
Name Type Description
index Number optional Since the index of the line you want may vary, you can specificy the index here.
Default Value:
  • 3

staticKonsole.hide()

Hides the console

staticKonsole.info(values)

Log a info message to the console
Name Type Description
values * repeatable . Can be any valid javascript object/type
Example
Konsole.info("myString", 5, true, [1,2,3,4], {myValue: "hello world"});

staticKonsole.log(values)

Log a message to the console
Name Type Description
values * repeatable . Can be any valid javascript object/type
Example
Konsole.log("myString", 5, true, [1,2,3,4], {myValue: "hello world"});

staticKonsole.monitor(value, name)

Monitor a value. Useful for repetitive/fast changing values.
Name Type Description
value * Your Value
name String The Name to identify the value with
Example
var incremental = 0;
Konsole.monitor(incremental, "My Value");
setInterval(function() {
    Konsole.monitor(incremental++, "My Value");
}, 500);

staticKonsole.observe(model, name)

Observe a Data Object for any modifications. This method only works in Browsers that support Object.observe
Name Type Description
model Object The Object/Model to observe
name String The Name to identify the model with
Example
var myObject = {person: "John Doe", age: 32, usesKonsole: true};
Konsole.observe(myObject, "PersonData");
myObject.age = 35;

staticKonsole.report(data)

If Konsole.reportingEnabled is true and a valid Konsole.reportingUrl is defined, allows you to send data to KonsoleReport for storage.
Name Type Description
data Object A freely definable object containing any values you may want to log
Example
var reportData = {
    type: "log", // Can be log, system, event, info, warn, error, report
    msg:  "This is my message" // The message to show in the Report
    callee: "MyClass.js" // optional

    // add any number of properties you want to log, nested object are also allowed
};
Konsole.report(reportData);

staticKonsole.resize(percentage)

Resizes the console
Name Type Description
percentage Number optional Percentage of the screen size (0-100) the konsole should take up.
Default Value:
  • 22

staticKonsole.sep()

Log a seperator to the console

staticKonsole.separator()

Log a seperator to the console

staticKonsole.show()

Shows the console

staticKonsole.system(values)

Log a system message to the console
Name Type Description
values * repeatable . Can be any valid javascript object/type
Example
Konsole.system("myString", 5, true, [1,2,3,4], {myValue: "hello world"});

staticKonsole.warn(values)

Log a warn message to the console
Name Type Description
values * repeatable . Can be any valid javascript object/type
Example
Konsole.warn("myString", 5, true, [1,2,3,4], {myValue: "hello world"});