ee6bcc6734813933a0055c9aac80997d4e674af6
[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 _0x6f8d=['[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','exports','Logger','transports','File','error','info','Console','env','winston','util','path','join','/var','log','xcally','format','message','replace'];(function(_0xea2a65,_0x4764fc){var _0x5699d0=function(_0x570bd3){while(--_0x570bd3){_0xea2a65['push'](_0xea2a65['shift']());}};_0x5699d0(++_0x4764fc);}(_0x6f8d,0x9e));var _0xd6f8=function(_0x51ac09,_0x383098){_0x51ac09=_0x51ac09-0x0;var _0x3f827d=_0x6f8d[_0x51ac09];return _0x3f827d;};'use strict';var moment=require('moment');var winston=require(_0xd6f8('0x0'));var util=require(_0xd6f8('0x1'));var path=require(_0xd6f8('0x2'));var debugLevel='INFO';function filename(_0xa58506,_0x1fc165){return path[_0xd6f8('0x3')](_0xd6f8('0x4'),_0xd6f8('0x5'),_0xd6f8('0x6'),util[_0xd6f8('0x7')]('%s-%s.log',_0xa58506,_0x1fc165));}function formatter(_0x19ce48,_0x4039fa){_0x4039fa[_0xd6f8('0x8')]=_0x4039fa[_0xd6f8('0x8')][_0xd6f8('0x9')](/@@{/g,'{{{')['replace'](/}@@/g,'}}}')['replace'](/@{/g,'{{')[_0xd6f8('0x9')](/}@/g,'}}');return util[_0xd6f8('0x7')](_0xd6f8('0xa'),moment()[_0xd6f8('0x7')](_0xd6f8('0xb')),_0x4039fa['level'][_0xd6f8('0xc')](),_0x19ce48,_0x4039fa['message']);}module[_0xd6f8('0xd')]=function(_0x12dbf1){return new winston[(_0xd6f8('0xe'))]({'transports':[new winston[(_0xd6f8('0xf'))][(_0xd6f8('0x10'))]({'name':util[_0xd6f8('0x7')]('%s-%s',_0x12dbf1,'error'),'filename':filename(_0x12dbf1,_0xd6f8('0x11')),'level':_0xd6f8('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xc98f49){return formatter(_0x12dbf1,_0xc98f49);}}),new winston[(_0xd6f8('0xf'))][(_0xd6f8('0x10'))]({'name':util[_0xd6f8('0x7')]('%s-%s',_0x12dbf1,_0xd6f8('0x12')),'filename':filename(_0x12dbf1,_0xd6f8('0x12')),'level':_0xd6f8('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x147041){return formatter(_0x12dbf1,_0x147041);}}),new winston['transports'][(_0xd6f8('0x13'))]({'level':process[_0xd6f8('0x14')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x44956e){return formatter(_0x12dbf1,_0x44956e);}})]});};