/**
 * Define a server logger for a context.
 * @function serverside.logger.newErrorLogger
 * @param {object} context - Sever context object.
 * @returns {object} - An logger object.
 * @protected
 * @ignore
 * @author Taka Okunishi
 */
var path = require('path'),
    lib = require('../../lib'),
    log = lib.log,
    FileLogger = log.FileLogger;

module.exports = function (context) {
    context.assertKeys(['LOG_LEVEL', 'ERROR_LOG_PATH']);
    return new FileLogger(context.LOG_LEVEL)
        .filename(path.resolve(context.ERROR_LOG_PATH))
        .console(!!context.CONSOLE_ENABLED);
};