'use strict';

var logger = require('winston');

function removeEndingNewLineCharacter(message) {
    var lastCharacter;

    if (message.length > 0) {
        lastCharacter = message[message.length - 1];

        if (lastCharacter === '\n') {
            return message.slice(0, -1);
        }
    }

    return message;
}

function getInfoStream() {
    return {
        write: function (message) {
            logger.info(removeEndingNewLineCharacter(message));
        }
    };
}

function getLogger() {
    return logger;
}

module.exports = {
    getLogger: getLogger,
    getInfoStream: getInfoStream
};

@@ -42,16 +42,86 @@
 ton');%0A%0A
+function removeLastCharacter(text) %7B%0A    return text.slice(0, -1);%0A%7D%0A%0A
 function
@@ -330,27 +330,35 @@
 urn 
-message.slice(0, -1
+removeLastCharacter(message
 );%0A 

Extract function for removing the last character of a text