/**
 * Filename    : cerny.conf.js
 * Author      : Robert Cerny
 * Created     : 2007-01-03
 * Last Change : 2009-01-15
 *
 * Description:
 *   This is the configuration file for the Cerny.js JavaScript
 *   library. It must be provided to the JavaScript enginge before the
 *   cerny.js file. In a browser environment this means, that the
 *   script tag for the configuration must be included in the HTML
 *   page *before* the cerny.js tag.
 *
 *   The configuration consits of one object CERNY.Configuration and
 *   one function CERNY.configure. The function will be called in
 *   cerny.js. This function call is named the configuration
 *   cut. Everything before that is not affected by the effects of
 *   configure. This means e.g. that interception is not available
 *   before the cut.
 *
 *   This file should not be used in place, but rather be copied in the
 *   context (e.g. the scripts dir in your application) and modified
 *   there.
 *
 * History:
 *   2007-03-30 Added CERNY.Configuration.Logger.ROOT.
 *   2007-03-29 Providing a catalog for Cerny.js.
 *   2007-01-03 Created.
 */

if (typeof CERNY != 'object') {
    CERNY = {};
}

CERNY.Configuration = {
    Logger: {

        // The indent string for logging. For logging to a HTML
        // document "&nbsp;&nbsp;" might be appropriate.
        "indentStr": "&nbsp;&nbsp;",

        // The root category takes effect if there is no level specified
        // for the category or any parent category of a logger. If ROOT
        // is not present, those loggers are set to "OFF".
        "ROOT": "FATAL",

        // The top category of the Cerny.js library
        "CERNY": "FATAL",
        "CERNY.load": "TRACE",

        "CO.cernyjs": "OFF",
        "DateUtils": "FATAL",

        // The category NONE is used as a base for loggers which are
        // forced onto objects with some intercepted functions, but do
        // not have a Logger stored in the member "logger".
        "NONE": "TRACE"
    },

    // The catalog is use to resolve dependencies, which are stated in
    // a script by the means of CERNY.require.
    Catalog: {
        "co.cerny.js.dir": "/cerny.js",
        "js.dir": "{co.cerny.js.dir}/js",
        "vendor.dir": "{co.cerny.js.dir}/vendor",

        "cerny.js.dir": "{vendor.dir}/cerny.js",
        "CERNY.js.Array":"{cerny.js.dir}/js/Array.js",
        "CERNY.js.Date":"{cerny.js.dir}/js/Date.js",
        "CERNY.js.Number":"{cerny.js.dir}/js/Number.js",
        "CERNY.js.String":"{cerny.js.dir}/js/String.js",
        "CERNY.js.doc.Generator":"{cerny.js.dir}/js/doc/Generator.js",
        "CERNY.js.doc.Schema":"{cerny.js.dir}/js/doc/Schema.js",
        "CERNY.json.HtmlPrettyPrinter":"{cerny.js.dir}/json/HtmlPrettyPrinter.js",
        "CERNY.json.Printer":"{cerny.js.dir}/json/Printer.js",
        "CERNY.json.TextPrettyPrinter":"{cerny.js.dir}/json/TextPrettyPrinter.js",
        "CERNY.schema":"{cerny.js.dir}/schema/schema.js",
        "CERNY.text.DateFormat":"{cerny.js.dir}/text/DateFormat.js",
        "CERNY.text.NumberFormat":"{cerny.js.dir}/text/NumberFormat.js",
        "CERNY.util":"{cerny.js.dir}/util/util.js",

        "crockford.dir": "{vendor.dir}/crockford",
        "Object.toJSONString": "{crockford.dir}/json.js",

        "CO.cernyjs": "{js.dir}/index.js",
        "CO.cernyjs.demos.Family": "{js.dir}/demos/Family.js",
        "CO.cernyjs.demos.examples": "{js.dir}/demos/Examples.js",
        "CO.cernyjs.demos.Demo": "{js.dir}/demos/Demo.js"

    },
    Interception: {
        active: []
    }
};

/**
 * Configure the Cerny.js lib. Takes effect only after the
 * configuration cut (call of this function in cerny.js).
 */
CERNY.configure = function() {

    // Define the interceptors of your choice
    CERNY.Configuration.Interception.active.push(CERNY.Interceptors.LogIndenter);
    // CERNY.Configuration.Interception.active.push(CERNY.Interceptors.Profiler);
    CERNY.Configuration.Interception.active.push(CERNY.Interceptors.Tracer);
    // CERNY.Configuration.Interception.active.push(CERNY.Interceptors.TypeChecker);

    // Redefine the log layout. The default is copied here from
    // cerny.js. Modify to match your requirements.
    // CERNY.Logger.layout = function(date, levelName, indentStr, message, loggerName) {
    //     return date.getTime() + ", " + levelName + ": " + indentStr + message + " | " + loggerName;
    // };

    // Redefine the log appenders. The default is [CERNY.print]. An
    // appender is a function taking one string parameter, the message
    // to be logged.
    CERNY.Logger.appenders = [CERNY.print];
}

CERNY.print = function(message) {
    CERNY.console.DomElement.print(message);
}
