editor: removed unused code
[fnpeditor.git] / src / fnpjs / logging / formatters.js
1 define(function() {
2
3 'use strict';
4
5
6 var formatterFromFormatString = function(formatString) {
7     return function(record) {
8         var message = formatString
9                 .replace('%level', record.level || '-')
10                 .replace('%message', record.originalMessage)
11                 .replace('%logger', record.loggerName),
12             currentDate;
13         if(formatString.indexOf('%datetime') !== -1) {
14             currentDate = new Date();
15             message = message.replace('%datetime', + currentDate.getDate() + '-' +
16                             (currentDate.getMonth() + 1)  + '-' +
17                             currentDate.getFullYear() + ' ' +
18                             currentDate.getHours() + ':' +
19                             currentDate.getMinutes() + ':' +
20                             currentDate.getSeconds()
21                             );
22         }
23         return message;
24     };
25 };
26
27 return {
28     fromFormatString: formatterFromFormatString,
29     simple: formatterFromFormatString('[%level] %datetime (%logger) - %message'),
30     noop: formatterFromFormatString('%message')
31 };
32
33 });