555ac228e8b1ac99f3738ec056eb50e242414318
[motion2.git] / server / config / logger.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0xaf9a=['}}}','level','toUpperCase','exports','File','%s-%s','error','transports','info','Console','env','debugLevel','moment','winston','util','path','join','xcally','format','%s-%s.log','message','replace'];(function(_0x14b2b7,_0x10be86){var _0x3f0993=function(_0x3eadea){while(--_0x3eadea){_0x14b2b7['push'](_0x14b2b7['shift']());}};_0x3f0993(++_0x10be86);}(_0xaf9a,0x16c));var _0xaaf9=function(_0xa8122d,_0x42e54b){_0xa8122d=_0xa8122d-0x0;var _0x32f5b2=_0xaf9a[_0xa8122d];return _0x32f5b2;};'use strict';var moment=require(_0xaaf9('0x0'));var winston=require(_0xaaf9('0x1'));var util=require(_0xaaf9('0x2'));var path=require(_0xaaf9('0x3'));var debugLevel='INFO';function filename(_0x2657ec,_0x35bebe){return path[_0xaaf9('0x4')]('/var','log',_0xaaf9('0x5'),util[_0xaaf9('0x6')](_0xaaf9('0x7'),_0x2657ec,_0x35bebe));}function formatter(_0x1b32d6,_0x313bba){_0x313bba[_0xaaf9('0x8')]=_0x313bba[_0xaaf9('0x8')][_0xaaf9('0x9')](/@@{/g,'{{{')[_0xaaf9('0x9')](/}@@/g,_0xaaf9('0xa'))[_0xaaf9('0x9')](/@{/g,'{{')[_0xaaf9('0x9')](/}@/g,'}}');return util[_0xaaf9('0x6')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xaaf9('0x6')]('YYYY-MM-DD\x20HH:mm:ss'),_0x313bba[_0xaaf9('0xb')][_0xaaf9('0xc')](),_0x1b32d6,_0x313bba['message']);}module[_0xaaf9('0xd')]=function(_0x18e5d4){return new winston['Logger']({'transports':[new winston['transports'][(_0xaaf9('0xe'))]({'name':util[_0xaaf9('0x6')](_0xaaf9('0xf'),_0x18e5d4,'error'),'filename':filename(_0x18e5d4,_0xaaf9('0x10')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4d7c68){return formatter(_0x18e5d4,_0x4d7c68);}}),new winston[(_0xaaf9('0x11'))][(_0xaaf9('0xe'))]({'name':util['format'](_0xaaf9('0xf'),_0x18e5d4,_0xaaf9('0x12')),'filename':filename(_0x18e5d4,'info'),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x94d23){return formatter(_0x18e5d4,_0x94d23);}}),new winston[(_0xaaf9('0x11'))][(_0xaaf9('0x13'))]({'level':process[_0xaaf9('0x14')][_0xaaf9('0x15')]||debugLevel,'json':![],'formatter':function(_0x480c1c){return formatter(_0x18e5d4,_0x480c1c);}})]});};