'use strict';

var Writer = require('./writer');

function getLocal() {
    return new Writer();
}

var glb = new Writer();

function getGlobal() {
    console.log = function () {
        glb.log.apply(glb, arguments);
    };
    console.error = function () {
        glb.error.apply(glb, arguments);
    };
    console.warn = function () {
        glb.warn.apply(glb, arguments);
    };
    console.info = function () {
        glb.info.apply(glb, arguments);
    };
    console.success = function () {
        glb.success.apply(glb, arguments);
    };

    return glb;
}

var exp = module.exports = new Writer(true);

Object.defineProperty(exp, 'local', {
    get: getLocal,
    enumerable: true
});

Object.defineProperty(exp, 'global', {
    get: getGlobal,
    enumerable: true
});

Object.freeze(exp);
