Browse files

Changing global underscore templateSettings breaks underscore templat…

…ing.
  • Loading branch information...
1 parent 49f2718 commit 5b64b1c35a50a6326170987e92cc6a442605a4b2 @shawnburke shawnburke committed Oct 3, 2012
Showing with 7 additions and 4 deletions.
  1. +7 −4 lib/winston-mail.js
View
11 lib/winston-mail.js
@@ -12,9 +12,12 @@ var winston = require('winston');
var _ = require('underscore');
// Set Underscore to Mustache style templates
-_.templateSettings = {
- interpolate : /\{\{(.+?)\}\}/g
-};
+
+function template(text, obj) {
+ return _.template(text,obj, {
+ interpolate : /\{\{(.+?)\}\}/g
+ });
+}
/**
* @constructs Mail
@@ -33,7 +36,7 @@ var Mail = exports.Mail = function (options) {
this.from = options.from || "winston@" + os.hostname()
this.level = options.level || 'info';
this.silent = options.silent || false;
- this.subject = options.subject ? _.template(options.subject) : _.template("winston: {{level}} {{msg}}")
+ this.subject = options.subject ? template(options.subject) : template("winston: {{level}} {{msg}}")
this.handleExceptions = options.handleExceptions || false;
this.server = email.server.connect({

0 comments on commit 5b64b1c

Please sign in to comment.