Skip to content
This repository has been archived by the owner on Jun 19, 2020. It is now read-only.

Commit

Permalink
Woodman crashed when message to log to console ended with an object
Browse files Browse the repository at this point in the history
Same bug as in #32: the console appender also expected the final
bit to send to the console to be a string and not to be an object.
However, in browser environments, Woodman typically send objects
as-is to the console.
  • Loading branch information
François Daoust committed Jan 29, 2014
1 parent f7bfe66 commit fdc05de
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/appenders/consoleappender.js
Expand Up @@ -19,6 +19,7 @@ if (typeof define !== 'function') {

define(function (require) {
var Appender = require('../appender');
var utils = require('../utils');

/**
* Definition of the Appender class
Expand Down Expand Up @@ -67,7 +68,9 @@ define(function (require) {
});
if (message) {
lastMsg = message[message.length-1];
if (lastMsg && (lastMsg.lastIndexOf('\n') === lastMsg.length - 1)) {
if (lastMsg &&
utils.isString(lastMsg) &&
(lastMsg.lastIndexOf('\n') === lastMsg.length - 1)) {
message[message.length-1] = lastMsg.substring(0, lastMsg.length - 1);
}
}
Expand Down

0 comments on commit fdc05de

Please sign in to comment.