Built motion from commit d5e4af8c.|2.6.23
[motion2.git] / server / utils / loggers.js
index c5a4032..bf0c862 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5b7d=['redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','addColors','/var/log/xcally','format','%s-%s.log','message','replace','}}}','YYYY-MM-DD\x20HH:mm:ss','level','{{{','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','toUpperCase','Logger','transports','Console','warn','error','File','%s-%s','fileLogger','moment','winston','../config/environment','debugLevel','toLowerCase','info'];(function(_0x371f8d,_0x2d7355){var _0x3ed5fc=function(_0x1809ae){while(--_0x1809ae){_0x371f8d['push'](_0x371f8d['shift']());}};_0x3ed5fc(++_0x2d7355);}(_0x5b7d,0x8a));var _0xd5b7=function(_0x42f226,_0x54d9a4){_0x42f226=_0x42f226-0x0;var _0x385118=_0x5b7d[_0x42f226];return _0x385118;};'use strict';var path=require('path');var util=require('util');var moment=require(_0xd5b7('0x0'));var winston=require(_0xd5b7('0x1'));var config=require(_0xd5b7('0x2'));var debugLevel=config[_0xd5b7('0x3')]?config[_0xd5b7('0x3')][_0xd5b7('0x4')]():_0xd5b7('0x5');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xd5b7('0x6'),'error':_0xd5b7('0x7'),'warn':_0xd5b7('0x8'),'info':_0xd5b7('0x9'),'print':_0xd5b7('0xa'),'success':_0xd5b7('0xb'),'http':'gray','verbose':'bold\x20magenta','debug':'bold\x20blue','silly':'bold\x20cyan'};winston[_0xd5b7('0xc')](XC_LOG_COLORS);function getLogFileName(_0x443cde,_0x3f1e0b,_0x4cbfce){var _0x326ef9=_0x443cde||_0xd5b7('0xd');return path['join'](_0x326ef9,util[_0xd5b7('0xe')](_0xd5b7('0xf'),_0x3f1e0b,_0x4cbfce));}function formatter(_0xe20b48,_0x3469aa){_0x3469aa[_0xd5b7('0x10')]=_0x3469aa[_0xd5b7('0x10')]['replace'](/@@{/g,'{{{')[_0xd5b7('0x11')](/}@@/g,_0xd5b7('0x12'))[_0xd5b7('0x11')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xd5b7('0xe')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xd5b7('0xe')](_0xd5b7('0x13')),_0x3469aa[_0xd5b7('0x14')]['toUpperCase'](),_0xe20b48,_0x3469aa[_0xd5b7('0x10')]);}function fileFormat(_0x3862a2,_0x159b97){_0x159b97[_0xd5b7('0x10')]=_0x159b97['message'][_0xd5b7('0x11')](/@@{/g,_0xd5b7('0x15'))['replace'](/}@@/g,_0xd5b7('0x12'))['replace'](/@{/g,'{{')[_0xd5b7('0x11')](/}@/g,'}}');var _0x593208=_0x159b97[_0xd5b7('0x16')]&&Object[_0xd5b7('0x17')](_0x159b97[_0xd5b7('0x16')])[_0xd5b7('0x18')]?'\x0a\x09'+JSON[_0xd5b7('0x19')](_0x159b97[_0xd5b7('0x16')]):'';return util[_0xd5b7('0xe')](_0xd5b7('0x1a'),moment()[_0xd5b7('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),_0x159b97[_0xd5b7('0x14')][_0xd5b7('0x1b')](),_0x3862a2,_0x159b97[_0xd5b7('0x10')],_0x593208);}function consoleLogger(){var _0xbf6b62=new winston[(_0xd5b7('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xd5b7('0x1d'))][(_0xd5b7('0x1e'))]({'level':_0xd5b7('0x1f'),'json':![],'formatter':function(_0x473157){return formatter('',_0x473157);}})]});return _0xbf6b62;}function fileLogger(_0x6cf844,_0x3fe743){var _0x10c1b8=new winston[(_0xd5b7('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xd5b7('0x1d'))]['File']({'name':util['format']('%s-%s',_0x6cf844,_0xd5b7('0x20')),'filename':getLogFileName(_0x3fe743,_0x6cf844,_0xd5b7('0x20')),'level':_0xd5b7('0x20'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2e7536){return fileFormat(_0x6cf844,_0x2e7536);}}),new winston[(_0xd5b7('0x1d'))][(_0xd5b7('0x21'))]({'name':util['format'](_0xd5b7('0x22'),_0x6cf844,debugLevel),'filename':getLogFileName(_0x3fe743,_0x6cf844,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x317583){return fileFormat(_0x6cf844,_0x317583);}}),new winston[(_0xd5b7('0x1d'))][(_0xd5b7('0x1e'))]({'level':_0xd5b7('0x1f'),'json':![],'formatter':function(_0x4961a7){return fileFormat(_0x6cf844,_0x4961a7);}})]});return _0x10c1b8;}exports['consoleLogger']=consoleLogger;exports[_0xd5b7('0x23')]=fileLogger;
\ No newline at end of file
+var _0x15c6=['stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','toUpperCase','Logger','warn','transports','File','error','%s-%s','Console','consoleLogger','fileLogger','path','util','moment','winston','../config/environment','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','format','%s-%s.log','message','{{{','replace','}}}','YYYY-MM-DD\x20HH:mm:ss','meta','keys'];(function(_0x5888d0,_0x2074ce){var _0x478a16=function(_0x110ca8){while(--_0x110ca8){_0x5888d0['push'](_0x5888d0['shift']());}};_0x478a16(++_0x2074ce);}(_0x15c6,0xea));var _0x615c=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x15c6[_0x4e7d25];return _0x526fe6;};'use strict';var path=require(_0x615c('0x0'));var util=require(_0x615c('0x1'));var moment=require(_0x615c('0x2'));var winston=require(_0x615c('0x3'));var config=require(_0x615c('0x4'));var debugLevel=config['debugLevel']?config['debugLevel'][_0x615c('0x5')]():_0x615c('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x615c('0x7'),'error':_0x615c('0x8'),'warn':_0x615c('0x9'),'info':_0x615c('0xa'),'print':'bold\x20white','success':_0x615c('0xb'),'http':_0x615c('0xc'),'verbose':_0x615c('0xd'),'debug':_0x615c('0xe'),'silly':_0x615c('0xf')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x45ff22,_0x3130cb,_0x52e002){var _0x4c91fd=_0x45ff22||'/var/log/xcally';return path['join'](_0x4c91fd,util[_0x615c('0x10')](_0x615c('0x11'),_0x3130cb,_0x52e002));}function formatter(_0x1f819b,_0x486f0b){_0x486f0b[_0x615c('0x12')]=_0x486f0b[_0x615c('0x12')]['replace'](/@@{/g,_0x615c('0x13'))[_0x615c('0x14')](/}@@/g,_0x615c('0x15'))[_0x615c('0x14')](/@{/g,'{{')[_0x615c('0x14')](/}@/g,'}}');return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x615c('0x10')](_0x615c('0x16')),_0x486f0b['level']['toUpperCase'](),_0x1f819b,_0x486f0b[_0x615c('0x12')]);}function fileFormat(_0x2bc867,_0x16b86c){_0x16b86c[_0x615c('0x12')]=_0x16b86c['message'][_0x615c('0x14')](/@@{/g,_0x615c('0x13'))[_0x615c('0x14')](/}@@/g,_0x615c('0x15'))[_0x615c('0x14')](/@{/g,'{{')[_0x615c('0x14')](/}@/g,'}}');var _0x56cabc=_0x16b86c[_0x615c('0x17')]&&Object[_0x615c('0x18')](_0x16b86c['meta'])['length']?'\x0a\x09'+JSON[_0x615c('0x19')](_0x16b86c[_0x615c('0x17')]):'';return util['format'](_0x615c('0x1a'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x16b86c['level'][_0x615c('0x1b')](),_0x2bc867,_0x16b86c[_0x615c('0x12')],_0x56cabc);}function consoleLogger(){var _0x533412=new winston[(_0x615c('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['Console']({'level':_0x615c('0x1d'),'json':![],'formatter':function(_0x37e638){return formatter('',_0x37e638);}})]});return _0x533412;}function fileLogger(_0x4830fe,_0x316555){var _0x3fc7ff=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x615c('0x1e'))][(_0x615c('0x1f'))]({'name':util[_0x615c('0x10')]('%s-%s',_0x4830fe,_0x615c('0x20')),'filename':getLogFileName(_0x316555,_0x4830fe,_0x615c('0x20')),'level':_0x615c('0x20'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x455d29){return fileFormat(_0x4830fe,_0x455d29);}}),new winston[(_0x615c('0x1e'))][(_0x615c('0x1f'))]({'name':util['format'](_0x615c('0x21'),_0x4830fe,debugLevel),'filename':getLogFileName(_0x316555,_0x4830fe,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x281f40){return fileFormat(_0x4830fe,_0x281f40);}}),new winston[(_0x615c('0x1e'))][(_0x615c('0x22'))]({'level':'warn','json':![],'formatter':function(_0x35f638){return fileFormat(_0x4830fe,_0x35f638);}})]});return _0x3fc7ff;}exports[_0x615c('0x23')]=consoleLogger;exports[_0x615c('0x24')]=fileLogger;
\ No newline at end of file