<commit_before>(function () {
    


    var log = {
            msg: function (msg) {
                if (console && console.log) {
                    console.log(msg);
                }
            },

            err: function (msg) {
                if (console && console.error) {
                    console.error(msg);
                }
            }
        },

        norne = function (opts, callback) {
            callback.apply(norne, norne.world(opts));
        };

    /**
     *  basic functionality
     */
    _(norne).extend({

        /**
         * Used to extend norne itself.
         *
         * @param {String} name Name of the extension
         * @param {Object} opts Optional object whos properties
         *                      are getting mapped to fn
         * @param {Function} fn Optional function that gets appended
         *                      
         */
        register: function (name, opts, fn) {

            if (norne[name]) {
                log.err('Module with this name already exists (' + name + ')');
                return
            }

            if (!_(name).isString()) {
                log.err('First parameter must be a string').
                return
            }

            if (norne[name] !== undefined) {
                log.err('An extension called "'+ name +'" already exists');
                return;
            }

            if (_(opts).isFunction()) {
                fn = opts
                opts = {}
            }

            opts = opts || {};
            fn = fn || function () {};

            /*
             *  bind opts context to the function
             *  and extend the returned proxy
             */
            fn = _(fn).bind(opts);
            _(fn).extend(opts);

            norne[name] = fn;
            return norne[name];
        }
    });

    norne.register('log', log, log.msg);
    window.norne = norne;
}());<commit_msg>fixed wrong property encapsulation in norne.register; Optimized norne.log<commit_after>(function () {
    'use strict';

    var log = {
            __out: function (channel, context, args) {
                channel.apply(context, args);
            },

            msg: function () {
                if (console && console.log) {
                    var args = Array.prototype.slice.call(arguments);
                    this.__out(console.log, console, args);
                }
            },

            err: function () {
                if (console && console.error) {
                    var args = Array.prototype.slice.call(arguments);
                    this.__out(console.error, console, args);
                }
            },

            trace: function() {
                if (norne.debug) {
                    this.msg(arguments);
                }
            }
        },

        norne = function (opts, callback) {
            log.trace('core: norne called as fn with', { opts: opts, callback: callback });
            callback.call(norne, norne.world(opts));
        },

        exc = { toString: function () { return this.name } };

    /**
     *  basic functionality
     */
    _(norne).extend({

        debug: true,
        version: 0.1,

        /**
         * Used to extend norne itself.
         *
         * @param {String} name Name of the extension
         * @param {Object} opts Optional object whos properties
         *                      are getting mapped to fn
         * @param {Function} fn Optional function that gets appended
         *                      
         */
        register: function (name, opts, fn) {
            var registerExc = _(exc).extend({ name: 'norne.registerException' }),
                proxy;

            if (!_(name).isString()) {
                throw _(exc).extend({
                    message: 'First parameter must be a string.'
                });
            }

            if (norne[name]) {
                throw _(exc).extend({
                    message: 'Module with this name already exists (' + name + ')'
                });
            }

            if (_(opts).isFunction()) {
                fn = opts
                opts = {}
            }

            opts = opts || {};
            fn = fn || function () {};

            proxy = function () {
                var args = Array.prototype.slice.call(arguments);
                args.unshift(norne);
                return fn.apply(norne[name], args);
            }

            _(proxy).extend(opts);
            norne[name] = proxy;
        },

        toString: function () {
            return 'Norne Engine Version ' + this.version;
        }
    });

    norne.register('log', log, log.msg);
    window.norne = norne;
}());
{'fraction_non_alphanumeric': 0.11865845892591806, 'fraction_numerical': 0.0004245383145828911, 'mean_word_length': 1.1311623699683402, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1006783', 'n_tokens_mistral': 1210, 'n_tokens_neox': 1134, 'n_words': 299}