{"_id":"happn-logger","_rev":"42-434f7f3e56a8e9a9406cce855c7adb4c","name":"happn-logger","description":"Logger using log4js","dist-tags":{"latest":"2.2.5","prerelease-1":"1.0.0-prerelease-2","prerelease-2":"2.2.6-prerelease-5"},"versions":{"0.0.1":{"name":"happn-logger","version":"0.0.1","description":"Logger using log4js","main":"index.js","scripts":{"test":"mocha test"},"repository":{"type":"git","url":"git+https://github.com/happner/happn-logger.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/happner/happn-logger/issues"},"homepage":"https://github.com/happner/happn-logger#readme","devDependencies":{"chai":"^3.4.1","mocha":"^2.3.4"},"dependencies":{"log4js":"^0.6.29"},"gitHead":"a2fa89eb71938b863d41f3d5067aa1b1d3f945d8","_id":"happn-logger@0.0.1","_shasum":"86d74b36977617fc5005d7815e2d2f06eaec27a1","_from":".","_npmVersion":"3.5.0","_nodeVersion":"0.10.40","_npmUser":{"name":"smc-tenacious","email":"eggers.jens@gmail.com"},"dist":{"shasum":"86d74b36977617fc5005d7815e2d2f06eaec27a1","tarball":"https://registry.npmjs.org/happn-logger/-/happn-logger-0.0.1.tgz","integrity":"sha512-xQTzSN7CmT/jWxa3vCtxHnhBghr3Irs6bcPzbBaP3CVxDzgcKQRWCaqFHYEe0e0wG0dCmiiqs1fzlNdDDC2HXg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCgBQJI4OM5/FIMt5quo0P2n6lEgvuYjLX/zdZSUFwNxwIhAPE/mYOG7xucjR+SMnpyVkCJZgl2VPm/+VwD0FcUEQXG"}]},"maintainers":[{"name":"smc-tenacious","email":"eggers.jens@gmail.com"}],"directories":{}},"0.0.2":{"name":"happn-logger","version":"0.0.2","description":"Logger using log4js","main":"index.js","scripts":{"test":"mocha test"},"repository":{"type":"git","url":"git+https://github.com/happner/happn-logger.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/happner/happn-logger/issues"},"homepage":"https://github.com/happner/happn-logger#readme","devDependencies":{"chai":"^3.4.1","mocha":"^2.3.4"},"dependencies":{"log4js":"^0.6.29"},"gitHead":"e67ad58158f55a1b0590d47efceb331a39089981","_id":"happn-logger@0.0.2","_shasum":"0267e720e2209f54ec50ad2e73caaf9048868b0e","_from":".","_npmVersion":"3.8.9","_nodeVersion":"0.10.36","_npmUser":{"name":"smc-tenacious","email":"eggers.jens@gmail.com"},"dist":{"shasum":"0267e720e2209f54ec50ad2e73caaf9048868b0e","tarball":"https://registry.npmjs.org/happn-logger/-/happn-logger-0.0.2.tgz","integrity":"sha512-SUjbtmdOF4eLw9cSVYzQBX0j/e+TlFr9Vt8beDlZDNJidKH/IEiSfs1FWd10wBK76iSRQVimnUe6bNz6JbBlrw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAe/OqCbsuc5GJ49Se2jFORJr+TT4CDIgMsNLh7PmvTiAiEAqEQmB0YYdr01P0Gvjf3XwI66WDWQOjTyq+IDxuHw3m0="}]},"maintainers":[{"name":"nomilous","email":"nomilous@gmail.com"},{"name":"smc-tenacious","email":"eggers.jens@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/happn-logger-0.0.2.tgz_1463731710947_0.6620980501174927"},"directories":{}},"0.1.0":{"name":"happn-logger","version":"0.1.0","description":"Logger using log4js","main":"index.js","scripts":{"test":"mocha test"},"repository":{"type":"git","url":"git+https://github.com/happner/happn-logger.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/happner/happn-logger/issues"},"homepage":"https://github.com/happner/happn-logger#readme","devDependencies":{"chai":"^3.4.1","mocha":"^2.3.4"},"dependencies":{"log4js":"^0.6.29"},"gitHead":"6a830cedffa3b94b929ba714f53a5b44f2353737","_id":"happn-logger@0.1.0","_npmVersion":"6.4.1","_nodeVersion":"6.11.1","_npmUser":{"name":"smc-tenacious","email":"eggers.jens@gmail.com"},"dist":{"integrity":"sha512-jbbTbipDfoQmhEV5HBeu7PczDHCf901f1meUxG9qxRGGGhcHW8/DIBD0S/Fek+t2/Z3iWNPVNiXuLqhJxxvYQQ==","shasum":"2456588a1cda40fe74094a66cbe4485b8f7a5204","tarball":"https://registry.npmjs.org/happn-logger/-/happn-logger-0.1.0.tgz","fileCount":8,"unpackedSize":34153,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcsHnbCRA9TVsSAnZWagAAHDIP/A0oF/2VZEnJv0qhpJNa\n3+C8HeMXE/1dRK8K/56IwFW7DSrMORlKD59TJl/PkIKhRs8LikmszVQ725P6\nbk0Ah2DAgDtVV2ORaInnIM3jOTiCXmrH5mR/l89erNUyVxJACK3JnM8S260s\nmn7XLgDYAv9uxx2YCagSSBQNq3uMmP/UVlzT9fT7AIYC4IUbaaLqklKZnG5z\nqh+Qwsw9O4bbKMFLsJ/HbFuLZ/0VedCY2aIVBtT6v2nyig1X9ML2hXLILT0A\ncnxOLqa9gElHYRwI/9wAGMm1Uzzw6RnaIwO0DCwLLf25R1S3oCMx24YzEkWg\nevSBHTRZbuO9wSPPA7PoB2CvzeRoaF73QCG3o0Ul1c7fRY0+cVFQiXykfYlg\nLhxnu3m8fzLmzTogzpDjHKrdgDh33TmrmMr/YX1EEjgYyEY+G8ly27ALe5tP\nItLyBWoAqdigjXo9XqFBvRRtg2GH4h27n7u7wyEzu2jlh3PZvBDR6MMd8DvZ\numxGAdJS7bP9SS7g/r9gx80B7IOsCsV++LiNkUNYutH3COJJqNzLbj5CFYVY\notGk1yvEWILs4SuASxxF+ib2y2zoQyjiUDcUPSyA/bE2Ar6nlpT6UwTxjk4h\nFpY/v8NzOIyIpuM2GDbnFEK/Bkr0jTfS93dUWGEa79q6pgVYTIF5CKhrtduc\nnFyH\r\n=aakF\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCiglScLaCVYGrSLhS+rCMNaBFST544GnnWFpm0jymzRwIhAP78fS6ya6h1w2iPP3sDfv0tdSglYnw97c5Jez1rvfUm"}]},"maintainers":[{"name":"nomilous","email":"nomilous@gmail.com"},{"name":"smc-tenacious","email":"eggers.jens@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/happn-logger_0.1.0_1555069402724_0.6983845449691475"},"_hasShrinkwrap":false},"0.1.1":{"name":"happn-logger","version":"0.1.1","description":"Logger using log4js","main":"index.js","scripts":{"test":"mocha test"},"repository":{"type":"git","url":"git+https://github.com/happner/happn-logger.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/happner/happn-logger/issues"},"homepage":"https://github.com/happner/happn-logger#readme","devDependencies":{"chai":"^3.4.1","mocha":"^2.3.4"},"dependencies":{"log4js":"^0.6.29"},"gitHead":"59dfd8000a432958fc533ad523ad6da48cf18475","_id":"happn-logger@0.1.1","_npmVersion":"6.4.1","_nodeVersion":"6.11.1","_npmUser":{"name":"smc-tenacious","email":"eggers.jens@gmail.com"},"dist":{"integrity":"sha512-EZbXdMPWtw7XH1Lm+ghqdecVN5XuvGckPe6vY+t/prU2+yhVaT3QHHTjpqFJpP3g+pbnk/nVs25wewwX5nb2pw==","shasum":"b1b78a0626fd10dc9438c93bf5cf80260d215bc1","tarball":"https://registry.npmjs.org/happn-logger/-/happn-logger-0.1.1.tgz","fileCount":8,"unpackedSize":34004,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcuBx9CRA9TVsSAnZWagAArqMQAIcqqXHn68TY49LScaDb\nFvWpboCDeR5t9IrovT2yRWHjofdamaF4s38KjKusG7EWDolSYm8Y1I61okYM\n2KBx4SMu4wciRAqn6L1I5a2JEPX+9Aw6bf1/0aDJkF8Q6Be02enSN2Z0HpBH\n7pcQ70e+1QqKlgye4jOnUzCH08wj9920jaNhsTxwBDYP6ij32Pn+Hw0HZCgh\nYNgYEThhl8w9YTofWdnJX5kqIGy55xQ2FVrXCfnFlf0nBPX7qUtpy+dJKCgM\nQQ0aSu+YA8aBh3Zno9a1yPicj6phdlaksAdRB2+KqUyzdp+0Vg1tNSNDV5IN\n0jjyXbfhJk3dTii0r07fHpTIkHjTM0o5EOxBGrQkuybFB8IxrllJbSKSVt+U\nE+ouhLcE7V1Yzc/GC+KMuHHfLEgBhafwNRP6ckHgZTM5A02WonPljsPL8X7V\nfY5QaxFh1uqQNjb7av/Xpia8zpOIxhlXeYqA6nVcQGnbbT1p3LT6dMJEgB1x\nJd2Nr0CPyH8hRHU07mhqK/Uu9YoxhvaPU5qvizBlOvemLtss9d+wzmqhE9fC\n4MLxHCz2algMdCrjUpZVgXFt2sGnggYJJ0oUbJ/qpYn6b/uVZ/9VETwnUh6o\nQcdjbEjKDyUzSDVQol4VGwnAcnT+WpaSdDXP6k+JxgQJZnslm4XUZDvR+n0+\n3l/2\r\n=sFS7\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCj/lFzVtH1WSSC+iUCBQn/gvXcCgTp0KMIbPe4aNPfOwIhAILOpeEKtQAaBzWnJOVMSBpKTMHYOQ6mtsF9vBIGztzg"}]},"maintainers":[{"name":"nomilous","email":"nomilous@gmail.com"},{"name":"smc-tenacious","email":"eggers.jens@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/happn-logger_0.1.1_1555569788183_0.8590210105454792"},"_hasShrinkwrap":false},"0.1.2":{"name":"happn-logger","version":"0.1.2","description":"Logger using log4js","main":"index.js","scripts":{"test":"mocha test"},"repository":{"type":"git","url":"git+https://github.com/happner/happn-logger.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/happner/happn-logger/issues"},"homepage":"https://github.com/happner/happn-logger#readme","devDependencies":{"chai":"^3.4.1","mocha":"^2.3.4"},"dependencies":{"log4js":"^0.6.29"},"gitHead":"ed268107e8c6c66e34097a1ec17b824fbd58c43a","_id":"happn-logger@0.1.2","_nodeVersion":"10.14.2","_npmVersion":"6.9.0","dist":{"integrity":"sha512-UjMEKVjnS6Xi3BWWyezCtsb8j+7PVTUI4i04Rs1dGONmXUDFovCcsLG4cFBi622IkYwtKlywmi2ko/VJG7t7Zg==","shasum":"d5a0fcde6db60b6992d0e358e49f1990ab7708d4","tarball":"https://registry.npmjs.org/happn-logger/-/happn-logger-0.1.2.tgz","fileCount":9,"unpackedSize":34305,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc1XRYCRA9TVsSAnZWagAAQ+kP/24CL2OXOCuc7QgAOEKQ\n9DSsl1wLf4m6wvt95/jL6V5pGn7ZkOg22scqS6LYQGK3L8yHQQv0CCSp387Q\nt3ZRsgS0luDMzNYH1GKm++DRg/DjTnO2bQ+MgR+jW7nxSgg8dL8WqHNDEUXT\nQE7G//tfRwsXSfruRwh3UO3lAwj3wPj1UvEZLad01bX8+hajYuyzws/QyGxK\nyRPwH1davkaC7tQSdZnyg2dgCtlpxCt7T1QqYK+xCc/loL8ugP8H9IWBDxpX\ngaR4WYhFPOUAQV5tQOPtRrjI3bu8t3XiKGSDUhRSzmnWPG/sIejPkqqNmNNg\nSjowSruHund9eqwyoygr2dc9kN8Qt9DYC+OZaM1BwLkmWW+UhMAOlUOb4uyQ\n2RGJMb/ixUInx+xm1vvoPg5HBj9O9d2YfDSeYr/NaP24MvFRCXu7lavRxhsN\n2oPUbvDwwyOltOHCmPAt7v0H9aW9zNFHZJ5RoXGvIAjsmZ6OLx6sd44Ntg/Z\nCcfxU82E6O1BgKmf3LxYGH5r3zAUcSBDhByrg8rwrn1D8+aB/57utXAWkcXC\n3XLcCHd071g4LcSssWRGRCaEZqeUMgUS6zHmur9mFDChC5xHU6lYiBhEtGRy\n7kt8olWTQ4qzpR2O7qq9tvcJxz7b1UT946ryON6SWzA0dpCx6VLaIOKIKpol\niq5D\r\n=wXcc\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCQFjKn3l2PVm+cm4NTe8JBrvz3pj/jMM53Ss0My8uPUgIhANzx0pMj0xRa/HQT2blGFe4lG1HxTHxgfynjXqZQCjjZ"}]},"maintainers":[{"name":"nomilous","email":"nomilous@gmail.com"},{"name":"smc-tenacious","email":"eggers.jens@gmail.com"}],"_npmUser":{"name":"smc-tenacious","email":"eggers.jens@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/happn-logger_0.1.2_1557492823447_0.8934540404108571"},"_hasShrinkwrap":false},"1.0.0-prerelease-1":{"name":"happn-logger","version":"1.0.0-prerelease-1","description":"Logger using log4js","main":"index.js","scripts":{"test":"mocha test"},"repository":{"type":"git","url":"git+https://github.com/happner/happn-logger.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/happner/happn-logger/issues"},"homepage":"https://github.com/happner/happn-logger#readme","devDependencies":{"capture-stdout":"^1.0.0","chai":"^3.4.1","mocha":"^2.3.4"},"dependencies":{"log4js":"^6.3.0"},"readme":"[![Build Status](https://travis-ci.org/happner/happn-logger.svg?branch=master)](https://travis-ci.org/happner/happn-logger)\n\n# happn-logger\n\n`npm install happn-logger --save`\n\nLogger using log4js.\n\nOne instance of the logger is shared processwide. (global)\n\n## Usage\n\nWith context and component.\n\n```javascript\nvar Logger = require('happn-logger');\nvar context = Logger.createContext('ContextName');\nvar log = context.createLogger('ComponentName');\n\nlog.info('message');\n// [ INFO] - 1ms    ContextName (ComponentName) message\n\n// log can create a new component logger in the same context\nvar log2 = log.createLogger('AnotherComponent');\n\n```\n\nWith component only.\n\n```javascript\nvar Logger = require('happn-logger');\nvar log = Logger.createLogger('ComponentName');\n\nlog.info('message');\n// [ INFO] - 1ms    (ComponentName) message\n```\n\nCreating log functions on existing object.\n\n```javascript\nvar Logger = require('happn-logger');\n\nvar thing = new Thing();\nLogger.createLogger('thing', thing);\n\nthing.info('message');\n// [ INFO] - 1ms    (thing) message\n```\n\n### Context\n\nThe context of the logger can be modified. The change is applied to all loggers in that context.\n\n```javascript\nvar Logger = require('happn-logger');\nvar logContext = Logger.createContext('ContextName');\nvar log1 = logContext.createLogger('ComponentName1');\nvar log2 = logContext.createLogger('ComponentName2');\n\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    ContextName (ComponentName1) message\n// [ INFO] - 0ms    ContextName (ComponentName2) message\n\nlogContext.context = 'Renamed';\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    Renamed (ComponentName1) message\n// [ INFO] - 0ms    Renamed (ComponentName2) message\n```\n\nThe context can be renamed from any one of the loggers and it will apply to all in the context.\n\n```javascript\nlog1.context('RenamedAgain');\n\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    RenamedAgain (ComponentName1) message\n// [ INFO] - 0ms    RenamedAgain (ComponentName2) message\n```\n\n### Format string\n\nWhen logging it is best not to pre-assemble the string to be logged because the cost of doing so is incurred even when the level being logged-to is not enabled.\n\neg. `log.debug('number: ' + theNumber);`\n\nInstead, use a format string in the first argument. The logger will perform the string assembly internally __only if the log level is enabled__.\n\neg. `log.debug('number: %d, string: %s, json: %j', theNumber, theString, theObject);`\n\n### Levels\n\n```javascript\nlog.fatal('message');\nlog.error('message');\nlog.warn('message');\nlog.info('message');\nlog.debug('message');\nlog.trace('message');\n\nlog.log('message'); // goes to debug\n```\n\nDebug and trace messages can also be logged as follows\n\n```javascript\nlog.$$DEBUG('message');\nlog.$$TRACE('message');\n```\n\nThis allows for confident matchability to enable substituting all debug and trace calls out of production deployments. \n\n### Configuration\n\n__It is important. The configure() must be called at least once.__\n\nShown with default values below.\n\n```javascript\nvar Logger = require('happn-logger');\n\nLogger.configure({\n  logCacheSize: 50,\n  logLevel: 'info',\n  logTimeDelta: true,\n  logStackTraces: true,\n  logComponents: [],\n  logMessageDelimiter: '\\t',\n  logDateFormat: null,\n  logLayout: null,\n  logFile: null,\n  logFileMaxSize: 20480,\n  logFileBackups: 10,\n  logFileNameAbsolute: true,\n  logger: null\n});\n```\n\n#### logCacheSize\n\nAn array of recent log event messages is kept in `Logger.cache`. This specifies the size of that array.\n\nEnvironment variable __LOG_CACHE_SIZE__ overrides.\n\neg. `LOG_CACHE_SIZE=5000 node myServer.js`\n\n#### logLevel\n\noff, fatal, error, warn, info, debug, trace, all\n\nEnvironment variable __LOG_LEVEL__ overrides.\n\neg. `LOG_LEVEL=off node myServer.js`\n\n#### logTimeDelta\n\nLog the number of milliseconds since the previous log message.\n\n#### logStackTraces\n\nIf the last argument to the logger is an error, log the stack trace in a second message.\n\n#### logComponents\n\nAn array of log component names. Filters out all info, debug and trace messages from all component not in the list.\n\nEnvironment variable __LOG_COMPONENTS__ overrides.\n\neg. `LOG_COMPONENTS=component1,component2 node myServer.js`\n\n#### logMessageDelimiter\n\nThe delimiter appears between the timeDelta and the message.\n\n#### logDateFormat\n\nBy default no date appears in the log to console. However, dates are looged when the console is redirected (piped) to file. By specifying this format dates also be written to console.\n\neg. `'yyyy-MM-dd hh:mm:ss.SSS'`\n\n#### logLayout\n\nThis allows for specifying of the full log line layout. \n\neg.\n```javascript\n  ...\n  logLayout: {\n    type: 'pattern',\n    pattern: '%d{yyyy-MM-dd hh:mm:ss.SSS} [%[%5.5p%]] - %m'\n  },\n  ...\n```\n\n#### logFile\n\nIf specified - the logger logs to file and console. \n\n__Note: Using the file logger will in most cases fail to capture a logged fatal event that brought your server down. The file write is asynchronous and the exiting process does not wait. The log from console redirected to file will include the error because console writes are synchronous.__\n\n#### logFileMaxSize, logFileBackups\n\nLimit disk resources used by log file. This specifies how big the log file is allowed to get before 'archiving' it, and how many archive backups should be kept.\n\nIt creates `.log` (the current log), `.log.1` (the previous log), `.log.2` (older), etc\n\n#### logFileLayout\n\nSame as logLayout above - but for the logFile not the console.\n\n#### logFileNameAbsolute\n\nSpecifies if the specified logFile is an \"absolute\" filename. Don't know why it matters. It's a log4js parameter.\n\n#### logger\n\nEnables passing in a full log4js config. All log4js config fragments from the preceding list are ignored in favour of this full config.\n\neg.\n```javascript\n  ...\n  logger: {\n    appenders: [\n      {\n        type: \"console\",\n        layout: {\n          type: 'pattern',\n          pattern: '%d{yyyy-MM-dd hh:mm:ss.SSS} [%[%5.5p%]] - %m'\n        }\n      }\n    ]\n  },\n  ...\n```\n\n\n### Events\n\nThe logger emits an event before and after each log message. This enables console applications, terminals and similar to prepare for and/or recover from the logger performing a console write.\n\neg.\n```javascript\n\nLogger.emitter.on('before', function() {\n  // Runs immediately before every log write.\n});\n\nLogger.emitter.on('after', function() {\n  // Runs immediately after every log write.\n});\n\n//you can also listen for the actual log message and level\nLogger.emitter.on('after', function(level, message) {\n\n  //level = info|error|warn|debug\n  //message = 1ms<tab>hello\n\n});\n\n```\n\n","readmeFilename":"README.md","gitHead":"edb07f1fcbdd0f580f20a90d6a9c43dfc4681164","_id":"happn-logger@1.0.0-prerelease-1","_nodeVersion":"10.19.0","_npmVersion":"6.13.4","dist":{"integrity":"sha512-k7hRwVP0/UtnQYMB3sVLk1OtDdiCRzpRr9lIleT0NJAM9TNOeBEzwivXxSy2DBYbQ6sbxc8gy6VlkMRfqDdWiA==","shasum":"c897c834079d3c852f249fecbb1bbe50a1d1781b","tarball":"https://registry.npmjs.org/happn-logger/-/happn-logger-1.0.0-prerelease-1.tgz","fileCount":9,"unpackedSize":41112,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfrUvACRA9TVsSAnZWagAAtFwP/3DHIwiIh19Hg8la7V4U\nBjXvBWHqjPEW5K4r5LvdpuiwRUR3xH9XV/xvuO8zrQKYPgPexhhQgk10KMKT\nhmdXSPtxKyvuTtmfEKQnrZUBKedzWXslR700kmv8h21DXwvI6VHq/zj/QdoC\nBRx6owjxVX1S3/E34Hhe94NXzOVeZRRRH0NBr26NXTmqDZHg5nQncVvW5Sr6\nC32sgiBSKGGck5k+EoVCJaDR1sPcBdf6oR+uMBEKKw8WPDN+MA/kJI3kHD7C\n5wKHmo8cr6jC1afPYN4hPfBSCOrR/g0A0RApFHzA6ULH5IOawcP+iR+u3ylw\nRU5cwLkVgJRGrGPGgaATwZ8XFyUSO7qTxKfoFzH+2TVPjlLi+qLiXtGz9MxF\nSyPMjmYS0UVEIzmuuAsWeEhA/p9/jJz9JqWh+TKwmCKJMOloawf7szb1kS8A\nn96kz//8LpEQVjrXIzd3N3gG1nVa8d0qYcLTrXk93dcL2hZK3926hKzIe5iG\nHlD0gIq3OueEl1yqC1/TluTyGbCnNQzNLkgomm+G+fppLzAOeLnW94JzLfd0\nDVgtrZAaHHbyfefgIE6kxq+YPMaAQVMmPGbKlm3DjdCPGwZAXUQR1v6IHYjU\noONw44+88CYPiv5J19gagtnS3OdTyHlVD9IL9kLqnUiC+FEWi4WVPJHr8BZG\nYawt\r\n=5Xwb\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB4g9Y6j6xcVLkfh34Yq5YdqVmUo9ah7wI3L2mjcEwCeAiAmcB24DDvIn60KC724R3gEyuDV48Pkcz/zgQVz2KpPTg=="}]},"_npmUser":{"name":"smc-tenacious","email":"eggers.jens@gmail.com"},"directories":{},"maintainers":[{"name":"nomilous","email":"nomilous@gmail.com"},{"name":"smc-tenacious","email":"eggers.jens@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/happn-logger_1.0.0-prerelease-1_1605192640357_0.31097142097774144"},"_hasShrinkwrap":false},"1.0.0-prerelease-2":{"name":"happn-logger","version":"1.0.0-prerelease-2","description":"Logger using log4js","main":"index.js","scripts":{"test":"mocha test"},"repository":{"type":"git","url":"git+https://github.com/happner/happn-logger.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/happner/happn-logger/issues"},"homepage":"https://github.com/happner/happn-logger#readme","devDependencies":{"capture-stdout":"^1.0.0","chai":"^3.4.1","mocha":"^2.3.4"},"dependencies":{"log4js":"^6.3.0"},"readme":"[![Build Status](https://travis-ci.org/happner/happn-logger.svg?branch=master)](https://travis-ci.org/happner/happn-logger)\n\n# happn-logger\n\n`npm install happn-logger --save`\n\nLogger using log4js.\n\nOne instance of the logger is shared processwide. (global)\n\n## Usage\n\nWith context and component.\n\n```javascript\nvar Logger = require('happn-logger');\nvar context = Logger.createContext('ContextName');\nvar log = context.createLogger('ComponentName');\n\nlog.info('message');\n// [ INFO] - 1ms    ContextName (ComponentName) message\n\n// log can create a new component logger in the same context\nvar log2 = log.createLogger('AnotherComponent');\n\n```\n\nWith component only.\n\n```javascript\nvar Logger = require('happn-logger');\nvar log = Logger.createLogger('ComponentName');\n\nlog.info('message');\n// [ INFO] - 1ms    (ComponentName) message\n```\n\nCreating log functions on existing object.\n\n```javascript\nvar Logger = require('happn-logger');\n\nvar thing = new Thing();\nLogger.createLogger('thing', thing);\n\nthing.info('message');\n// [ INFO] - 1ms    (thing) message\n```\n\n### Context\n\nThe context of the logger can be modified. The change is applied to all loggers in that context.\n\n```javascript\nvar Logger = require('happn-logger');\nvar logContext = Logger.createContext('ContextName');\nvar log1 = logContext.createLogger('ComponentName1');\nvar log2 = logContext.createLogger('ComponentName2');\n\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    ContextName (ComponentName1) message\n// [ INFO] - 0ms    ContextName (ComponentName2) message\n\nlogContext.context = 'Renamed';\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    Renamed (ComponentName1) message\n// [ INFO] - 0ms    Renamed (ComponentName2) message\n```\n\nThe context can be renamed from any one of the loggers and it will apply to all in the context.\n\n```javascript\nlog1.context('RenamedAgain');\n\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    RenamedAgain (ComponentName1) message\n// [ INFO] - 0ms    RenamedAgain (ComponentName2) message\n```\n\n### Format string\n\nWhen logging it is best not to pre-assemble the string to be logged because the cost of doing so is incurred even when the level being logged-to is not enabled.\n\neg. `log.debug('number: ' + theNumber);`\n\nInstead, use a format string in the first argument. The logger will perform the string assembly internally __only if the log level is enabled__.\n\neg. `log.debug('number: %d, string: %s, json: %j', theNumber, theString, theObject);`\n\n### Levels\n\n```javascript\nlog.fatal('message');\nlog.error('message');\nlog.warn('message');\nlog.info('message');\nlog.debug('message');\nlog.trace('message');\n\nlog.log('message'); // goes to debug\n```\n\nDebug and trace messages can also be logged as follows\n\n```javascript\nlog.$$DEBUG('message');\nlog.$$TRACE('message');\n```\n\nThis allows for confident matchability to enable substituting all debug and trace calls out of production deployments. \n\n### Configuration\n\n__It is important. The configure() must be called at least once.__\n\nShown with default values below.\n\n```javascript\nvar Logger = require('happn-logger');\n\nLogger.configure({\n  logCacheSize: 50,\n  logLevel: 'info',\n  logTimeDelta: true,\n  logStackTraces: true,\n  logComponents: [],\n  logMessageDelimiter: '\\t',\n  logDateFormat: null,\n  logLayout: null,\n  logFile: null,\n  logFileMaxSize: 20480,\n  logFileBackups: 10,\n  logFileNameAbsolute: true,\n  logger: null\n});\n```\n\n#### logCacheSize\n\nAn array of recent log event messages is kept in `Logger.cache`. This specifies the size of that array.\n\nEnvironment variable __LOG_CACHE_SIZE__ overrides.\n\neg. `LOG_CACHE_SIZE=5000 node myServer.js`\n\n#### logLevel\n\noff, fatal, error, warn, info, debug, trace, all\n\nEnvironment variable __LOG_LEVEL__ overrides.\n\neg. `LOG_LEVEL=off node myServer.js`\n\n#### logTimeDelta\n\nLog the number of milliseconds since the previous log message.\n\n#### logStackTraces\n\nIf the last argument to the logger is an error, log the stack trace in a second message.\n\n#### logComponents\n\nAn array of log component names. Filters out all info, debug and trace messages from all component not in the list.\n\nEnvironment variable __LOG_COMPONENTS__ overrides.\n\neg. `LOG_COMPONENTS=component1,component2 node myServer.js`\n\n#### logMessageDelimiter\n\nThe delimiter appears between the timeDelta and the message.\n\n#### logDateFormat\n\nBy default no date appears in the log to console. However, dates are looged when the console is redirected (piped) to file. By specifying this format dates also be written to console.\n\neg. `'yyyy-MM-dd hh:mm:ss.SSS'`\n\n#### logLayout\n\nThis allows for specifying of the full log line layout. \n\neg.\n```javascript\n  ...\n  logLayout: {\n    type: 'pattern',\n    pattern: '%d{yyyy-MM-dd hh:mm:ss.SSS} [%[%5.5p%]] - %m'\n  },\n  ...\n```\n\n#### logFile\n\nIf specified - the logger logs to file and console. \n\n__Note: Using the file logger will in most cases fail to capture a logged fatal event that brought your server down. The file write is asynchronous and the exiting process does not wait. The log from console redirected to file will include the error because console writes are synchronous.__\n\n#### logFileMaxSize, logFileBackups\n\nLimit disk resources used by log file. This specifies how big the log file is allowed to get before 'archiving' it, and how many archive backups should be kept.\n\nIt creates `.log` (the current log), `.log.1` (the previous log), `.log.2` (older), etc\n\n#### logFileLayout\n\nSame as logLayout above - but for the logFile not the console.\n\n#### logFileNameAbsolute\n\nSpecifies if the specified logFile is an \"absolute\" filename. Don't know why it matters. It's a log4js parameter.\n\n#### logger\n\nEnables passing in a full log4js config. All log4js config fragments from the preceding list are ignored in favour of this full config.\n\neg.\n```javascript\n  ...\n  logger: {\n    appenders: [\n      {\n        type: \"console\",\n        layout: {\n          type: 'pattern',\n          pattern: '%d{yyyy-MM-dd hh:mm:ss.SSS} [%[%5.5p%]] - %m'\n        }\n      }\n    ]\n  },\n  ...\n```\n\n\n### Events\n\nThe logger emits an event before and after each log message. This enables console applications, terminals and similar to prepare for and/or recover from the logger performing a console write.\n\neg.\n```javascript\n\nLogger.emitter.on('before', function() {\n  // Runs immediately before every log write.\n});\n\nLogger.emitter.on('after', function() {\n  // Runs immediately after every log write.\n});\n\n//you can also listen for the actual log message and level\nLogger.emitter.on('after', function(level, message) {\n\n  //level = info|error|warn|debug\n  //message = 1ms<tab>hello\n\n});\n\n```\n\n","readmeFilename":"README.md","gitHead":"edb07f1fcbdd0f580f20a90d6a9c43dfc4681164","_id":"happn-logger@1.0.0-prerelease-2","_nodeVersion":"10.19.0","_npmVersion":"6.13.4","dist":{"integrity":"sha512-PlMvkz4y+D+hWW2+Qwke4/ZQt+2OHlcW1NnhKjrIwDEXFL8R+d+DVWp/c4QI59gaWwKToZNxDdIwRbwEkL7Dzg==","shasum":"1ca553effc92189cf547a11bc9595379574177ec","tarball":"https://registry.npmjs.org/happn-logger/-/happn-logger-1.0.0-prerelease-2.tgz","fileCount":9,"unpackedSize":41338,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfs9ZMCRA9TVsSAnZWagAAdKMQAJxKVgWlZWDQ3dQcKQy6\nV17FdDgtt1lTBZLTNRhtZGKxq1MgrukfQHpeYXqCyou5c7+1N81iOXp9Ig7v\nxC0ZuS0HntD0KkLBepbzDjdweO/NUrZOWQvqXS2u/CwPTdShm2RhEyvp/zVY\nnfBySv19oXdESZZabpIea31Wm3522hG7UZapZaEH/0yv3bxDhnCmj4EXeWix\nwo8k5bIr3XJWtBJXZuWnGxECkgPAeWp66AV0SlBG69i2LaIxub5/sHyTcatR\ni0RECg4G8ozQ4AO9o5leD6tNlpUhD4wEyuLBVl24fjpf3UwD88kKIJpVSwL+\n3E25uH3k1zRfI+2BlScedoGAhjxnEUxq7QVNWfxoGWuCFx/Cr5Sl4ZPYVzjX\nvtEcLxbZikaKid+lAHPw4N+Z3OKdPsMama3QZ9ghmwD60une9RYcnVgCqnFy\nUK2TqwKksEo2+VelDqMSf52x9S5vYYxTo8GAJqMgHHSuS373h/Y4ugMbanS+\nqYnkjVRcAQVRt1y7QWZYzW3WzjXcxLfC9uqf8KigiEm2MigkgTj8K4Foeu4I\nliow9k1RO1ph3/kp5dWX+MWZYeRTESDBn/5KqNWMtWFN9VLxjrEsbv5yV0IZ\nXkTprNQdjtZ90ej2kek3iF3a8JB4UUoA5L9PwxQPBUYiM4qCbWOA1F6yicVk\n1aaG\r\n=Nqs7\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDZ0vG7WvAxKOPuH6KAWOrSowwQvCt0/uheRLWKprD+ywIgZ23quYHr0ib4oyCowO0kOnqaARhVlk9wLZb2Pcivcxk="}]},"_npmUser":{"name":"smc-tenacious","email":"eggers.jens@gmail.com"},"directories":{},"maintainers":[{"name":"nomilous","email":"nomilous@gmail.com"},{"name":"smc-tenacious","email":"eggers.jens@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/happn-logger_1.0.0-prerelease-2_1605621323876_0.007726953119195468"},"_hasShrinkwrap":false},"1.0.0":{"name":"happn-logger","version":"1.0.0","description":"Logger using log4js","main":"index.js","scripts":{"test":"mocha test"},"repository":{"type":"git","url":"git+https://github.com/happner/happn-logger.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/happner/happn-logger/issues"},"homepage":"https://github.com/happner/happn-logger#readme","devDependencies":{"capture-stdout":"^1.0.0","chai":"^3.4.1","mocha":"^2.3.4"},"dependencies":{"log4js":"^6.3.0"},"gitHead":"4579c510a1d6f8549aa99e543b9ba93f5c4a69de","_id":"happn-logger@1.0.0","_nodeVersion":"10.19.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-B64seUx3yKpVURd5Ha1yft3Vx9t854yL42BPuM/GeKagO0ZelAlz/RfCLQcXfuRYuE/gOF538E+Xgpsf8f/HKQ==","shasum":"43e10fe1cf4ba05bc9a79a8fcbf487c14fdb0d52","tarball":"https://registry.npmjs.org/happn-logger/-/happn-logger-1.0.0.tgz","fileCount":9,"unpackedSize":41325,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfthbQCRA9TVsSAnZWagAAcVIP/R006E2P7iQQZHy5SeTw\nBRJGA9fWruxky/fRKd3kejyZ6yqOPF8vfHbzbIBP0iWZJYmSyPb5MuR5yG2B\nEOskkTBzH75Gj+FA785zfvldxq0zKOlQZmGYAwkMBJTNGQQ//J5iwFPegaBY\ndLmza7xoxZUhIHi8SGhTz+xDxhFkd6HR4pkZxmLMUr9sUHRhfOBvELD1c8Re\nzxSiRfEmLIN1XpZAdizi2VS9otwIlZi4ytvQpEQGNSirGznIzs/FYmShFM3Z\ndVtLbhaJGzuq1IMDsWPcNQDbSO68j/Hz7rU/zDOXHEXNf8o5I5RFgkBoXJkK\n75Tnyz3JTT002nibR0ZvPU+AmzkF0i82RHpiWm2alW5wdH4HhNnyJjGBiyRB\n9A0gMC7yJEJ81ea79tLUoqrlZrPr0li6D1o3e/RKXkgfKKufQNfBS3OTiv6G\n/tZtr+SVRDyN7Oq+mbx7aBAGxE4gOpBw3FD0v2m/iBEBceKkiocp+dLxeGkP\nu4tpv9WyQL5KpzrY69LWyS38Il8l80WT9SzVoMw2TkvMPXkO5EGySCxP+pcw\njZAIeThWowL0iFMx5ECTN/dWuCawJ4tv5+cn07acy51wL8cFYrpPrFkRPQch\nRIzrEkl2r6aWiPB0+D//DW8n6GUJNP3ptWIA0EvKugc4ys22AQgCuvXUUvuS\nD6za\r\n=ML8m\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIC6mRbzd2og56Fq/TVFY+UK+C4yQE2Qed+IZOWRRH7tlAiAxO8Fk60RMXHpA1vq0x8JO8xS5nDCfVWRp2+p0zHFkNA=="}]},"_npmUser":{"name":"smc-tenacious","email":"eggers.jens@gmail.com"},"directories":{},"maintainers":[{"name":"nomilous","email":"nomilous@gmail.com"},{"name":"smc-tenacious","email":"eggers.jens@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/happn-logger_1.0.0_1605768911988_0.34199429717806074"},"_hasShrinkwrap":false},"1.1.0":{"name":"happn-logger","version":"1.1.0","description":"Logger using log4js","main":"index.js","scripts":{"test":"mocha test"},"repository":{"type":"git","url":"git+https://github.com/happner/happn-logger.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/happner/happn-logger/issues"},"homepage":"https://github.com/happner/happn-logger#readme","devDependencies":{"capture-stdout":"^1.0.0","chai":"^3.4.1","mocha":"^2.3.4"},"dependencies":{"log4js":"^6.3.0"},"gitHead":"f2373c6d9c7ca394593ebcfe3a2c343e0abeab93","_id":"happn-logger@1.1.0","_nodeVersion":"10.19.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-8BNGP7IBFaa5C1/Z/0Q2ED6DLSFcjEuWtMMsh0dJ5Na/rDn6q+7P0AOt5G7V9lL4uc85cL4RG6Y9BfZllW9PeQ==","shasum":"52635831de5249ba6689334e6e29e64a69725ebe","tarball":"https://registry.npmjs.org/happn-logger/-/happn-logger-1.1.0.tgz","fileCount":9,"unpackedSize":42562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfti41CRA9TVsSAnZWagAAHasP/AsYv/Ge/CmP7ORkn7TT\nNUOCTNMtquw/C9LP2oggcK99Yrck3mH1PuGmLca+8hFZXzf7nXDpFNDg2sim\nd1gOf9DFA5irsfxMwiYrd28+leVdKflKtGXuOaDR3Wm1dVAaP8Iwe6Xr3JlA\n+TpYv4S937XEE7doOKHlfQlCADM+rVWloM1qmgj24AjDIXVWypapc6Xhej05\nNcsVbrpDTT+r9LfgxUMz6AkivCItpURISwlSb6KezyGvehT91cUqDrYrfwFM\nmFOUPb6PCiRsRBs5nduiIRb086YkKojs+z4hOtJVldiMrvvu4zaJydEpAFqy\n6c3iHsOCth5HI+5qzBPBlvpUONhqD+VMxSU5gNhOLJuTaSX4QIj0plB02fO2\nYDRH1wScmdie/9ecXhCvLzLEo77OTslAwuBOxcLTe47ql+HaBiGyp1JLt7cm\nDSfqOOHHGGbyDqkeCqaEXbOHgBS31bfdRUwiv39tK5hyxZI8QVJdf0RexB9J\n0nhdDhKfxU2sOuvn3MCMwgHtxdIA2BGt6D4Fv5i9jNnqjpTO6tLBQPzC/gdq\n1WZgRjDdVvfy6Zh17CyKrGSdlj/8d9S1y14WmpkB4hMCmNTmYfRO1Sxcp7we\nTZODDS5NApVCUQlRABbjHyTjmt6LzQT4PXmAhfjpUNlQla48BCm05QotJWH5\nb9t8\r\n=JlWm\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDwGSB+iWhjFKEDKYi7oG1AGyXY633mVp62fzj7tNTkHgIgTaO9ViTByZs63vSer/bMwXJ9O37hCCf5Yvfzzw+5e/E="}]},"_npmUser":{"name":"smc-tenacious","email":"eggers.jens@gmail.com"},"directories":{},"maintainers":[{"name":"nomilous","email":"nomilous@gmail.com"},{"name":"smc-tenacious","email":"eggers.jens@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/happn-logger_1.1.0_1605774900587_0.674931936497611"},"_hasShrinkwrap":false},"1.1.1":{"name":"happn-logger","version":"1.1.1","description":"Logger using log4js","main":"index.js","scripts":{"test":"mocha test"},"repository":{"type":"git","url":"git+https://github.com/happner/happn-logger.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/happner/happn-logger/issues"},"homepage":"https://github.com/happner/happn-logger#readme","devDependencies":{"capture-stdout":"^1.0.0","chai":"^3.4.1","mocha":"^2.3.4"},"dependencies":{"log4js":"^6.3.0"},"gitHead":"bafda6e26b95bf7afd45d23c15a17a5e34ba22dc","_id":"happn-logger@1.1.1","_nodeVersion":"10.19.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-Fl87PAX6gJZvHodllq4mvjuQLARzolQuNKhDRx0eEDUz6GvvVqxvzNNHYZGqj/dc+A6JKp3LwUwoLCxeFsiTdA==","shasum":"8d377fe9a940f294e299de03b40ce915a0e55b1a","tarball":"https://registry.npmjs.org/happn-logger/-/happn-logger-1.1.1.tgz","fileCount":9,"unpackedSize":42618,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfu5xNCRA9TVsSAnZWagAACGsP/2cYgPXCaaeZZeT6ccDI\nItJ8hx718IO7s5d4CZfLj/GnH0G6Yi0n099vTr6QG9yvRNePTk7I63nYPkNB\n7L3pff8q3UkMHn7t0qSmbqv+nMfyyPI0LtL0NTGvFiGSG8EHVSn3FnFiUR5W\ndG2oSOIVN1K8PQl4R3pcDfiIPoKwwhuDQBUx/mLWICxnHX4wxA52HIa6rrWT\n4kQ7VfIZ1L7W3VPeCe6ruYgzBHgVOoP/Vlx0nHTg5LIDcNTZY4o1oqKCKYAl\nvtJvumqDWjMa/hSGL1gxW6FX3CWWGRQQJl+kYk7j/4F2WqfCdnAIR1NEmJBS\ndyc6dmNBF6o8WN5/yOrrN7eCTnsyl21kNDhc4f5qZlkDoT1ZvcWeCBly8NvF\ndZDJFNgSbpG2o0L+BeLVGSivkRJTk0wVoDAtZG+IYv3pc+ieo+cunJ+jTiv7\nkJmZatSxtIiixqTuXhiLJC++FRUt8m/fjoKO6WAzZqe0ayeCmBWL1vWbS0pF\nzuWhoTheqsG/dyhdLvVXl0SN7RwzOPqdc1NajboixFZkykVwi0C6YR6syrqi\nVspASNo32c9IKwBMZUOS1klf34sRpzmoY+UUcjYghXFZx1yFlEINrmherOFW\nd4yWz4jMmBo9CpW5xv6TIv5WY20ryWm+9nLOD7vu10WF/Z0ltWFyBSxqxv+t\n9WZh\r\n=q/CF\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICos/0svUDqyAkWmq5isx/26zaDjwV0oNuB3n0/HzQUjAiEAub4MFgWjHby/4uodHYm/Gc4J1nP/zbMoYn1gE+j8xfM="}]},"_npmUser":{"name":"smc-tenacious","email":"eggers.jens@gmail.com"},"directories":{},"maintainers":[{"name":"nomilous","email":"nomilous@gmail.com"},{"name":"smc-tenacious","email":"eggers.jens@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/happn-logger_1.1.1_1606130765135_0.0036443133815571294"},"_hasShrinkwrap":false},"2.0.0":{"name":"happn-logger","version":"2.0.0","description":"Logger using log4js","main":"index.js","scripts":{"test":"_mocha --recursive --exit silence.js test/*","test-cover":"nyc --reporter=lcov --reporter=text-summary --reporter=html npm test"},"repository":{"type":"git","url":"git+https://github.com/happner/happn-logger.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/happner/happn-logger/issues"},"homepage":"https://github.com/happner/happn-logger#readme","devDependencies":{"capture-stdout":"^1.0.0","happn-commons-test":"^1.0.0"},"dependencies":{"log4js":"^6.3.0"},"gitHead":"eeda8f6df5c9904d21b507e259adcca40154ad54","_id":"happn-logger@2.0.0","_nodeVersion":"16.13.1","_npmVersion":"8.1.2","dist":{"integrity":"sha512-yVLEePFXRswOlhwab0+G6aSkP1VMF5NTQhI7oyi37vu9rB2f3vXrzBm7GM/VAha0daR385Ox9FxYZVEIu7zlcw==","shasum":"09347584e7678ac061aad90d7e176afd247b3484","tarball":"https://registry.npmjs.org/happn-logger/-/happn-logger-2.0.0.tgz","fileCount":32,"unpackedSize":281924,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiHn2vACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpc7g//RVynHeCEi37yK+y5HAmb598/1HKJwJi4dpjUmCJ5k8kQQgnc\r\nBUarcQofxm8+xWITbsTYNQe0/kxZtzD9wXA39lWISeUsCThuEd6T6XKSAJj2\r\n9zu745FbfsL8AtVLJLx9Pf0N4ulqoRHYK6XtoUD4CIZ6n+Aik1wOrEhlfKNJ\r\nbMQGSOdzeeXUnOUiLXVZBiUCf5FAz0OoCnW343aTdpNZahS5yIC9YEPmHrd1\r\n24t9DVMxR5jrMIiOasZ9iv5poA5vW1Rg7hzMKLf0OIkERgUWpIv4O7zFJlCt\r\nNdP+vY9HtBz7/YvBDFcReaBXF7zAvg0dyLmT5PzoQFUjOMkPje1RHjvAXl2v\r\nC/vZlww8A2VNQlvjXACAubZQ5Z1JCDhnrSuUPl1ipFckRcNDXb4OvF/EcAMw\r\nb+CjIxSy9+zt3fzZAh5sUbUM9vMU/yv5otiG5r71eypxFBKnCkhBfobQPLct\r\nabr5tocYEVW3uZPMOCK6V3GOUST6nlLRKmdeDmDf0yF7g2m+5d2X0S7hKDSl\r\nj50draKUuppQPbKi6x9jyN6olmUUgCzgA6frnWT2pKeneDRof8ZVZLet1K2r\r\n1+TzGITn1wCxp6Toq0yGAMyqPqG5flTfyXMMiaEIB+YdFhWeoCZOv7D9guOQ\r\nQNVzTZoRg5GlLrld2YVUHXEJm1y95hx4IDs=\r\n=sjX6\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHeXYcKKnGvVq3/IeHreteSlAlAz/BB6QkzRB2kCtzcfAiEA1PGhhPJ95x8hmK+A8JuxJlNus4gL1JZzsrv5+DvtAqc="}]},"_npmUser":{"name":"smc-tenacious","email":"eggers.jens@gmail.com"},"directories":{},"maintainers":[{"name":"nomilous","email":"nomilous@gmail.com"},{"name":"smc-tenacious","email":"eggers.jens@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/happn-logger_2.0.0_1646165422868_0.949599072499772"},"_hasShrinkwrap":false},"2.0.1":{"name":"happn-logger","version":"2.0.1","description":"Logger using log4js","main":"index.js","scripts":{"test":"_mocha --recursive --exit silence.js test/*","test-cover":"nyc --reporter=lcov --reporter=text-summary --reporter=html npm test"},"repository":{"type":"git","url":"git+https://github.com/happner/happn-logger.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/happner/happn-logger/issues"},"homepage":"https://github.com/happner/happn-logger#readme","devDependencies":{"capture-stdout":"^1.0.0","happn-commons-test":"^1.0.0"},"dependencies":{"log4js":"^6.3.0"},"gitHead":"5c630df63ffd761e64c5fd005b044d84808d916c","_id":"happn-logger@2.0.1","_nodeVersion":"16.13.1","_npmVersion":"8.1.2","dist":{"integrity":"sha512-p9D76ohfvoVJXlaw8a42tO93t4lNYDLlVQDDDVFE+pp+kaJE9oAykLDfN9l/oATJX/EcV/bGpLmm1TPmc50WiQ==","shasum":"14c787b0fff5c4b2190ec46e7aef24cf4c1f6876","tarball":"https://registry.npmjs.org/happn-logger/-/happn-logger-2.0.1.tgz","fileCount":6,"unpackedSize":22040,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiILukACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoA7A//ddno5FeSGM9pkWSGhHvkGCAdttr3fmYVTC41ZrhZAuxBnflm\r\npWq59Pza+NN/BSlRU4HrCNj1shKWe9eIwOUonlWXOfD/wsHMtnxut+qTkj2p\r\nnFKYeILCuIWXe3EPw/GV0JAtNyiPm5yVR85NE6zU/GPSJpp8lzp+VTUz91ZL\r\nQ70UqX0sNciU2FPZDRV8kVDQ1HH+z0k+JxPsLoWrWNaVw2fCttO2LAAojXna\r\nEjuXYN42EJ96L0BvrV1g8HLAF1+glNEmQYSTWoofqUtqxFgjEg5QXN9TB53s\r\nnu70VHfpgmGuXukMS7vO2b0N9tAE9vLzOYYnoWvhvcTQ9hf9ivWpiIK074uj\r\nQy6MhXxEY0Jte9hxvCAjGMA1aLR3vS7vkJIkOxn/zVX0De7DXD+fbXIxJ0dL\r\nH16EiWTWi9Bb0SNgB9gBszWrbQjJkiGkJFhdzzopjnxJs3rY8+vg0z4GHiBm\r\n9vJu9QeVVjk8YVn6aB+fveSlXttcB7ypkWF9OBY3DQ8V2AcdRJSmtLVzr0r8\r\nEmiUgyzxJAKuVo+UCUzPPijJg9cJuNRVoIEdb93PZ4xT+s+Sk6I3frthC3nM\r\nPj7/yvUOkIioeE/Se0XISVScwD00vwMu9uxnq5plcW43f9QJq1klnGCc5MYF\r\njkyp78C9VY3XywRe2IoZ5TBjjv3cpBn39D8=\r\n=UR39\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBGHllPr7RaKJKZfUtfu2SDcOG9N+VQlFfRAnwd7+pxvAiBJxiL11pLZIgV68I2H5zRRG58sUVCSMyFIoUHAorF/4A=="}]},"_npmUser":{"name":"smc-tenacious","email":"eggers.jens@gmail.com"},"directories":{},"maintainers":[{"name":"nomilous","email":"nomilous@gmail.com"},{"name":"smc-tenacious","email":"eggers.jens@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/happn-logger_2.0.1_1646312355860_0.7520414782517166"},"_hasShrinkwrap":false},"2.0.2":{"name":"happn-logger","version":"2.0.2","description":"Logger using log4js","main":"index.js","scripts":{"test":"_mocha --recursive --exit silence.js test/*","test-cover":"nyc --reporter=lcov --reporter=text-summary --reporter=html npm test"},"repository":{"type":"git","url":"git+https://github.com/happner/happn-logger.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/happner/happn-logger/issues"},"homepage":"https://github.com/happner/happn-logger#readme","devDependencies":{"capture-stdout":"^1.0.0","happn-commons-test":"^1.0.2"},"dependencies":{"log4js":"^6.3.0"},"gitHead":"c207a480014df818acf5bdd44f931f1382fca8f3","_id":"happn-logger@2.0.2","_nodeVersion":"17.1.0","_npmVersion":"8.1.4","dist":{"integrity":"sha512-uzd0OFPeMqva6VPpGd+8dkcCzwmbeKAkMFq5RiKeMZb2LJfZMg7oOCnhh80AWfhcngjO8438MwuoJAjc+vWtEg==","shasum":"85f7d7b5bc0ab282c7c04e47270e3df5271954a5","tarball":"https://registry.npmjs.org/happn-logger/-/happn-logger-2.0.2.tgz","fileCount":6,"unpackedSize":21960,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiKzPEACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp+hA//aZi0e3lpbxr7Bo26MUtQiuQHm3hH+08yWgn8uO2NUKmtcOBS\r\nTJuejtwhBALJmDc9qsUR9hAH6Rr/VN5pVeV4pHS3EXTkSCE8KOw9tZJLn53+\r\n7NF13zA+0KxcwoKlc6jynCZgBxZ5u7QoVLp78Ow5kTqSZuTyMHNZAQ9PpSLa\r\n+hLQM/8J0dA9Ya9cI6rFQoidKJcYLmNywVJaeEd4lR9QkdP56LrmL4GEMy0D\r\nJJ9gk72iQ6Vt/p2l+pZmpM0uJ/aZufhZdzNZIzyK92rFfdbNkr8dqUaVJLgG\r\n1ROqDOzBMaCyXZIBCD/PbHZ3N1li8iWjU9qXP89jJtxSUvkuP1/yX/1RW8sz\r\nh8Es4SSoAdidrJ/4NE0uGnbSmVB24xCdsghqm7Qc6uxyRo84GLD4vgeaePZO\r\nzKYsn1eoB2l72t3dBAwvEsJKQtSnkIAS2KK8YEqFNiHQ1tD2O5HzjAvjA0UT\r\n+IQaN6THGUA+7dwXp1hKkkPPNfTK37n+zQiuapHh+JrYs4tEno7e57+EZtkM\r\nf9lOqkkHYlX+JrV66QY93tINPaq4AVchzaB9QD6YVLUOMygMVDXRqVBsdzvz\r\nSf+88xUUnvYFfm1OMlcWJ73Db1awX1HtxZDdHWoGpfuX24WAR8NUw/n7puY+\r\n/nEvbYXQUlLaFe22t/dbFc0ur18iRD03NQU=\r\n=yB9Y\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC7a4V0l6g7/7/Mm+YGhy3uXuCsddjOT5StyTy5vETk+wIhAIpOVmdKAuMdkNsS4Xwfgq96Ve6wozGI8jtKm1edu+HL"}]},"_npmUser":{"name":"smc-tenacious","email":"eggers.jens@gmail.com"},"directories":{},"maintainers":[{"name":"nomilous","email":"nomilous@gmail.com"},{"name":"smc-tenacious","email":"eggers.jens@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/happn-logger_2.0.2_1646998468598_0.11596617057544245"},"_hasShrinkwrap":false},"2.0.3":{"name":"happn-logger","version":"2.0.3","description":"Logger using log4js","main":"index.js","scripts":{"test":"_mocha --recursive --exit silence.js test/*","test-cover":"nyc --reporter=lcov --reporter=text-summary --reporter=html npm test"},"repository":{"type":"git","url":"git+https://github.com/happner/happn-logger.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/happner/happn-logger/issues"},"homepage":"https://github.com/happner/happn-logger#readme","devDependencies":{"capture-stdout":"^1.0.0","happn-commons-test":"^1.0.3"},"dependencies":{"log4js":"^6.3.0"},"gitHead":"3997c08f5f2630e6e099b8496e2620083b3d5eb8","_id":"happn-logger@2.0.3","_nodeVersion":"16.13.1","_npmVersion":"8.5.4","dist":{"integrity":"sha512-3MxLr3is8MlvhYyIHb0kSDezcDLhAbWsvhwmdZeezcb6XcY39ecRdmaw4Kv6JnEqhkWb85cyT2Yzg67JfzzuyA==","shasum":"63123040ea47bce3f404f451dfa6ae0fa426daba","tarball":"https://registry.npmjs.org/happn-logger/-/happn-logger-2.0.3.tgz","fileCount":6,"unpackedSize":22374,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiQ/4CACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpq3Q//eXVqt29VUJRevKV0XPDzEqRnUHv7QlOAoWUZG1W82LKk9nt0\r\n4SqGlhovWhy9EPfkh9g7qAvH/8+Xr1eTznVx0XvWMoWattbUjFqXW4Da5089\r\nDze/mipfziwBdCHkjzD8gDrCNPrPCfKH++v4BNjauxJESvZDGuGb0JiEOT8F\r\nyq0eyN+zMoD0vHOoCuxW9YT25uIxStDrtE0Y5JKKarsi8ySN6llsSjK7euE/\r\nKx5HLF8Qr05Ir2wbVt4QR2/vSLMW5678PIohbIAbTQD0KvgqLaJ4xbTf8cMu\r\nA8grBpmS3hi2ZVURpV9mZAd4ny645ZSB/p1Xku+auWxVvF77zoxST/EZy4UX\r\n6U9gH5Lw1I+OS9cVTWY/4gYC3dTWpvz1cnZnEgZ8opDBTX0pTHtudbkUH/FK\r\njkNjMWvcVStxRGSbqHHYUAMDQgeygcvC9QIv3wHzQ7Jlit5HEs9ndmrb5uYj\r\nXHnM+n7e7l+GgMIP77ns+gv6uIRnYoX/vvRf5RqDdZNUtUlxlLKmRl834nED\r\nd1xpoPNIjnXuV2WpFbgMeNBqH0v3TkUu6WeBs8gSBGA/h1wW91a8n+nWSOma\r\n6MzpvttzbEOHsBwB5lsyuWbD43lBasN+dTrsKEbka8y2EQrTQZoy74gbOQY+\r\n48a4UmhLjF9+gOgWcorO7Wjo5f7HG2wmGqI=\r\n=O69H\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDlpIHVRueI4PQTYHDseUR96LFqeo8yHkiOUZcE/rl3NQIhAJQaEaqPQv/yxuabPKw1u3mO9Ees7nz2boUUCCnHIBjL"}]},"_npmUser":{"name":"smc-tenacious","email":"eggers.jens@gmail.com"},"directories":{},"maintainers":[{"name":"nomilous","email":"nomilous@gmail.com"},{"name":"smc-tenacious","email":"eggers.jens@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/happn-logger_2.0.3_1648623106846_0.23939889158019434"},"_hasShrinkwrap":false},"2.0.4-prerelease.1":{"name":"happn-logger","version":"2.0.4-prerelease.1","description":"Logger using log4js","main":"index.js","scripts":{"test":"_mocha --recursive --exit silence.js test/*","test-cover":"nyc --reporter=lcov --reporter=text-summary --reporter=html npm test"},"repository":{"type":"git","url":"git+https://github.com/happner/happn-logger.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/happner/happn-logger/issues"},"homepage":"https://github.com/happner/happn-logger#readme","devDependencies":{"capture-stdout":"^1.0.0","happn-commons-test":"^1.0.4-prerelease.1"},"dependencies":{"log4js":"^6.3.0"},"readme":"[![Build Status](https://travis-ci.org/happner/happn-logger.svg?branch=master)](https://travis-ci.org/happner/happn-logger)\n\n# happn-logger\n\n`npm install happn-logger --save`\n\nLogger using log4js.\n\nOne instance of the logger is shared processwide. (global)\n\n## Usage\n\nWith context and component.\n\n```javascript\nvar Logger = require('happn-logger');\nvar context = Logger.createContext('ContextName');\nvar log = context.createLogger('ComponentName');\n\nlog.info('message');\n// [ INFO] - 1ms    ContextName (ComponentName) message\n\n// log can create a new component logger in the same context\nvar log2 = log.createLogger('AnotherComponent');\n\n```\n\nWith component only.\n\n```javascript\nvar Logger = require('happn-logger');\nvar log = Logger.createLogger('ComponentName');\n\nlog.info('message');\n// [ INFO] - 1ms    (ComponentName) message\n```\n\nCreating log functions on existing object.\n\n```javascript\nvar Logger = require('happn-logger');\n\nvar thing = new Thing();\nLogger.createLogger('thing', thing);\n\nthing.info('message');\n// [ INFO] - 1ms    (thing) message\n```\n\n### Context\n\nThe context of the logger can be modified. The change is applied to all loggers in that context.\n\n```javascript\nvar Logger = require('happn-logger');\nvar logContext = Logger.createContext('ContextName');\nvar log1 = logContext.createLogger('ComponentName1');\nvar log2 = logContext.createLogger('ComponentName2');\n\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    ContextName (ComponentName1) message\n// [ INFO] - 0ms    ContextName (ComponentName2) message\n\nlogContext.context = 'Renamed';\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    Renamed (ComponentName1) message\n// [ INFO] - 0ms    Renamed (ComponentName2) message\n```\n\nThe context can be renamed from any one of the loggers and it will apply to all in the context.\n\n```javascript\nlog1.context('RenamedAgain');\n\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    RenamedAgain (ComponentName1) message\n// [ INFO] - 0ms    RenamedAgain (ComponentName2) message\n```\n\n### Format string\n\nWhen logging it is best not to pre-assemble the string to be logged because the cost of doing so is incurred even when the level being logged-to is not enabled.\n\neg. `log.debug('number: ' + theNumber);`\n\nInstead, use a format string in the first argument. The logger will perform the string assembly internally __only if the log level is enabled__.\n\neg. `log.debug('number: %d, string: %s, json: %j', theNumber, theString, theObject);`\n\n### Levels\n\n```javascript\nlog.fatal('message');\nlog.error('message');\nlog.warn('message');\nlog.info('message');\nlog.debug('message');\nlog.trace('message');\n\nlog.log('message'); // goes to debug\n```\n\nDebug and trace messages can also be logged as follows\n\n```javascript\nlog.$$DEBUG('message');\nlog.$$TRACE('message');\n```\n\nThis allows for confident matchability to enable substituting all debug and trace calls out of production deployments. \n\n### Configuration\n\n__It is important. The configure() must be called at least once.__\n\nShown with default values below.\n\n```javascript\nvar Logger = require('happn-logger');\n\nLogger.configure({\n  logCacheSize: 50,\n  logLevel: 'info',\n  logTimeDelta: true,\n  logStackTraces: true,\n  logComponents: [],\n  logMessageDelimiter: '\\t',\n  logDateFormat: null,\n  logLayout: null,\n  logFile: null,\n  logFileMaxSize: 20480,\n  logFileBackups: 10,\n  logFileNameAbsolute: true,\n  logger: null\n});\n```\n\n#### logCacheSize\n\nAn array of recent log event messages is kept in `Logger.cache`. This specifies the size of that array.\n\nEnvironment variable __LOG_CACHE_SIZE__ overrides.\n\neg. `LOG_CACHE_SIZE=5000 node myServer.js`\n\n#### logLevel\n\noff, fatal, error, warn, info, debug, trace, all\n\nEnvironment variable __LOG_LEVEL__ overrides.\n\neg. `LOG_LEVEL=off node myServer.js`\n\n#### logTimeDelta\n\nLog the number of milliseconds since the previous log message.\n\n#### logStackTraces\n\nIf the last argument to the logger is an error, log the stack trace in a second message.\n\n#### logComponents\n\nAn array of log component names. Filters out all info, debug and trace messages from all component not in the list.\n\nEnvironment variable __LOG_COMPONENTS__ overrides.\n\neg. `LOG_COMPONENTS=component1,component2 node myServer.js`\n\n#### logMessageDelimiter\n\nThe delimiter appears between the timeDelta and the message.\n\n#### logDateFormat\n\nBy default no date appears in the log to console. However, dates are looged when the console is redirected (piped) to file. By specifying this format dates also be written to console.\n\neg. `'yyyy-MM-dd hh:mm:ss.SSS'`\n\n#### logLayout\n\nThis allows for specifying of the full log line layout. \n\neg.\n```javascript\n  ...\n  logLayout: {\n    type: 'pattern',\n    pattern: '%d{yyyy-MM-dd hh:mm:ss.SSS} [%[%5.5p%]] - %m'\n  },\n  ...\n```\n\n#### logFile\n\nIf specified - the logger logs to file and console. \n\n__Note: Using the file logger will in most cases fail to capture a logged fatal event that brought your server down. The file write is asynchronous and the exiting process does not wait. The log from console redirected to file will include the error because console writes are synchronous.__\n\n#### logFileMaxSize, logFileBackups\n\nLimit disk resources used by log file. This specifies how big the log file is allowed to get before 'archiving' it, and how many archive backups should be kept.\n\nIt creates `.log` (the current log), `.log.1` (the previous log), `.log.2` (older), etc\n\n#### logFileLayout\n\nSame as logLayout above - but for the logFile not the console.\n\n#### logFileNameAbsolute\n\nSpecifies if the specified logFile is an \"absolute\" filename. Don't know why it matters. It's a log4js parameter.\n\n#### logger\n\nEnables passing in a full log4js config. All log4js config fragments from the preceding list are ignored in favour of this full config.\n\neg.\n```javascript\n  ...\n  logger: {\n    appenders: [\n      {\n        type: \"console\",\n        layout: {\n          type: 'pattern',\n          pattern: '%d{yyyy-MM-dd hh:mm:ss.SSS} [%[%5.5p%]] - %m'\n        }\n      }\n    ]\n  },\n  ...\n```\n\n\n### Events\n\nThe logger emits an event before and after each log message. This enables console applications, terminals and similar to prepare for and/or recover from the logger performing a console write.\n\neg.\n```javascript\n\nLogger.emitter.on('before', function() {\n  // Runs immediately before every log write.\n});\n\nLogger.emitter.on('after', function() {\n  // Runs immediately after every log write.\n});\n\n//you can also listen for the actual log message and level\nLogger.emitter.on('after', function(level, message) {\n\n  //level = info|error|warn|debug\n  //message = 1ms<tab>hello\n\n});\n\n```\n\n","readmeFilename":"README.md","gitHead":"90268b6ca2497cf87638d323d872e74e1d442051","_id":"happn-logger@2.0.4-prerelease.1","_nodeVersion":"16.13.1","_npmVersion":"8.5.4","dist":{"integrity":"sha512-MwO+AJLr+ZrJlAn5wgTCTSXoJl8izJGiTyrxSryaaOObAhNV/hKWVACj7Jkg/1bnrx9Y2ijc0O0Iq4BVpQ/tSQ==","shasum":"bf4c987dc6786ce88868c916832b48a3bfb81fe6","tarball":"https://registry.npmjs.org/happn-logger/-/happn-logger-2.0.4-prerelease.1.tgz","fileCount":6,"unpackedSize":22482,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFWgqeKVOHS+jEyRXrrymm+gmAMmkD7he+Xnp620Hn/fAiEAjFsCFMFK/+QSYB3X/2gKDXc0pCkI7AZzYaSwKWjAjqo="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJig7iuACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpkPRAAnzbuq/XLyTUZKdMVLyxbXAhzEt6srTgYpE6lMKB3cpfu0WRu\r\np3XQyF9SkSNk4UQ68vUDTzbWEBVa1G5ajSCc+aZqnZvpvRBHVI748MYLMcE8\r\nWuu9gEwbyFlFb+TIv2Rgk1dIpjtQnIWU1cABZ5l4PtMa0w7uekUPhOdJT73o\r\n+VPZ5pwICN2fKqz4FvGMohSq9LgN3kB8vIrkvKXMiYP9bO0/NWY6CWMKY8rz\r\n7In4/T6ZUtBugHHDg4siPyFHRSzje+QpynPOTdDHr5IVIY3/G9+XyDbrQtJU\r\n8zELdTzCmXbUVEb+PBOGgK5kG++OD1By7Y+3OCp0O2MgGXeNuty1HnPwJhet\r\nN9Xg4mVV4dAl8cJeuvCNeSfF7aNW+x/jHrnfgFv68/t1eWylWgUStUOtIjkE\r\nAhoxmLOmyk7iMBQVFHfaKjk3lBgzRydU55Cg5QBtMV/v10hLaOKrPLFHXH24\r\nPoQgghJKIdN1oTk0Bf3s4kELncg85+LgPbnmIzc/M3AEi41y1hqS/E4YCwYi\r\nLzhYgDy3kojrTQywJcwc5QS3NByuO6WED9zbukTwwjsXxTjo8kRhv4WoOeKZ\r\nDa5pYKDnowpZiEDBXthpnsMzxHO+6Ybm3eteZzuqI/BW3/V0TMtQWyS9DP++\r\nTc7uCZIVihe4jUU7UTHarZmhbnYH8Hqet+o=\r\n=CMwQ\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"smc-tenacious","email":"eggers.jens@gmail.com"},"directories":{},"maintainers":[{"name":"nomilous","email":"nomilous@gmail.com"},{"name":"smc-tenacious","email":"eggers.jens@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/happn-logger_2.0.4-prerelease.1_1652799662722_0.7148721813258565"},"_hasShrinkwrap":false},"2.1.0":{"name":"happn-logger","version":"2.1.0","description":"Logger using log4js","main":"index.js","scripts":{"test":"_mocha --recursive --exit silence.js test/*","test-cover":"nyc --reporter=lcov --reporter=text-summary --reporter=html npm test"},"repository":{"type":"git","url":"git+https://github.com/happner/happn-logger.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/happner/happn-logger/issues"},"homepage":"https://github.com/happner/happn-logger#readme","devDependencies":{"capture-stdout":"^1.0.0","happn-commons-test":"^1.0.4"},"dependencies":{"log4js":"^6.3.0"},"gitHead":"9edbe27da81b88a20053d108053c413c570e545b","_id":"happn-logger@2.1.0","_nodeVersion":"16.13.1","_npmVersion":"8.5.4","dist":{"integrity":"sha512-9bdJsjh4X6RVA1UREuw8EhrnWg3XPMMKSxuDHrChpc3EorxRMtQ0ka6c2Td1n8cVVGBpFx8OtHiwYHVUIL2Amw==","shasum":"92ef847b44669e6e2f84c594efd760948b8ba004","tarball":"https://registry.npmjs.org/happn-logger/-/happn-logger-2.1.0.tgz","fileCount":6,"unpackedSize":22781,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCohKyVQNg70ArRbeBxDe3HdpyD60WlJw7BJl3UfzkASgIgUZ/GqRqj7i+UMce8JV3dsRYVuTEfR4L1ULrZ/qAGaZI="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJikPZ2ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpqSg/9FwpnDpU/67boRNzifIk0CSWIAALK+ZXRHW4ICnR2U1+5aEYU\r\nXHYWJaH9UaZvfxD2UE+9iGG7C8sFKdHIEB/VAr3HvfLcK1Fs6B7Kh0Pe4+Xq\r\n+yLRd4n36ohoNVSTFNbel9sQFFH9KZLeYjklOmFPN99IiC7QJQAog4SfEv6w\r\ntLFmwH3SfXwXHmpeJ/z4jQp4i/ZE4CKqjB+jAG1cE/vK+q7swGpyTU7tsVRJ\r\nzIJ/uJzryrsAQ+KI7glat2V9P7KDJHB2tps14Rh0tbNdbzCAQ14eXn0JQ3xx\r\nBNb9bwi5HSQ/IpevANXQilqlcjD/EyakCgwBhBUmdRzCHtRj5Q93DCnIKNW9\r\nNhgZK+nCDJ+8/Hst/neFRcCSXxJ+snSWt8Llf3/2TeP0BVybOkMSRqHjFbAB\r\nTPIFNvXxtPYOCsmtylvf1+rtB+2G2AK8Hzqy98RS7YUiklP+E7Ro5+sE4A6F\r\nNT5el5x+xGbP0tfsMjDXrXPe9CPKR2IwuHO6Q7VFbiN3//tLKEmS7u7gTJtE\r\nO/gnktLlkgibVLrnML/hjTla3ZRJEbmQ5Un0OShN40bdYLMns3WHDTqGbYiL\r\nt0p0pbCyPTV1ect/vMWXHGKzwOqb5HyiJ98CDmiVKYSJmd4lxoUQU/SZAOuj\r\nWDcKDs/ufYpzzZUlRURMw8k+jSGmrBUiQdk=\r\n=Mmmh\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"smc-tenacious","email":"eggers.jens@gmail.com"},"directories":{},"maintainers":[{"name":"nomilous","email":"nomilous@gmail.com"},{"name":"smc-tenacious","email":"eggers.jens@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/happn-logger_2.1.0_1653667446208_0.28589449683501944"},"_hasShrinkwrap":false},"2.1.1-prerelease-1":{"name":"happn-logger","version":"2.1.1-prerelease-1","description":"Logger using log4js","main":"index.js","scripts":{"test":"_mocha --recursive --exit silence.js test/*","test-cover":"nyc --reporter=lcov --reporter=text-summary --reporter=html npm test"},"repository":{"type":"git","url":"git+https://github.com/happner/happn-logger.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/happner/happn-logger/issues"},"homepage":"https://github.com/happner/happn-logger#readme","devDependencies":{"capture-stdout":"^1.0.0","happn-commons-test":"^1.1.0-prerelease-1"},"dependencies":{"log4js":"^6.3.0"},"readme":"[![Build Status](https://travis-ci.org/happner/happn-logger.svg?branch=master)](https://travis-ci.org/happner/happn-logger)\n\n# happn-logger\n\n`npm install happn-logger --save`\n\nLogger using log4js.\n\nOne instance of the logger is shared processwide. (global)\n\n## Usage\n\nWith context and component.\n\n```javascript\nvar Logger = require('happn-logger');\nvar context = Logger.createContext('ContextName');\nvar log = context.createLogger('ComponentName');\n\nlog.info('message');\n// [ INFO] - 1ms    ContextName (ComponentName) message\n\n// log can create a new component logger in the same context\nvar log2 = log.createLogger('AnotherComponent');\n\n```\n\nWith component only.\n\n```javascript\nvar Logger = require('happn-logger');\nvar log = Logger.createLogger('ComponentName');\n\nlog.info('message');\n// [ INFO] - 1ms    (ComponentName) message\n```\n\nCreating log functions on existing object.\n\n```javascript\nvar Logger = require('happn-logger');\n\nvar thing = new Thing();\nLogger.createLogger('thing', thing);\n\nthing.info('message');\n// [ INFO] - 1ms    (thing) message\n```\n\n### Context\n\nThe context of the logger can be modified. The change is applied to all loggers in that context.\n\n```javascript\nvar Logger = require('happn-logger');\nvar logContext = Logger.createContext('ContextName');\nvar log1 = logContext.createLogger('ComponentName1');\nvar log2 = logContext.createLogger('ComponentName2');\n\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    ContextName (ComponentName1) message\n// [ INFO] - 0ms    ContextName (ComponentName2) message\n\nlogContext.context = 'Renamed';\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    Renamed (ComponentName1) message\n// [ INFO] - 0ms    Renamed (ComponentName2) message\n```\n\nThe context can be renamed from any one of the loggers and it will apply to all in the context.\n\n```javascript\nlog1.context('RenamedAgain');\n\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    RenamedAgain (ComponentName1) message\n// [ INFO] - 0ms    RenamedAgain (ComponentName2) message\n```\n\n### Format string\n\nWhen logging it is best not to pre-assemble the string to be logged because the cost of doing so is incurred even when the level being logged-to is not enabled.\n\neg. `log.debug('number: ' + theNumber);`\n\nInstead, use a format string in the first argument. The logger will perform the string assembly internally __only if the log level is enabled__.\n\neg. `log.debug('number: %d, string: %s, json: %j', theNumber, theString, theObject);`\n\n### Levels\n\n```javascript\nlog.fatal('message');\nlog.error('message');\nlog.warn('message');\nlog.info('message');\nlog.debug('message');\nlog.trace('message');\n\nlog.log('message'); // goes to debug\n```\n\nDebug and trace messages can also be logged as follows\n\n```javascript\nlog.$$DEBUG('message');\nlog.$$TRACE('message');\n```\n\nThis allows for confident matchability to enable substituting all debug and trace calls out of production deployments. \n\n### Configuration\n\n__It is important. The configure() must be called at least once.__\n\nShown with default values below.\n\n```javascript\nvar Logger = require('happn-logger');\n\nLogger.configure({\n  logCacheSize: 50,\n  logLevel: 'info',\n  logTimeDelta: true,\n  logStackTraces: true,\n  logComponents: [],\n  logMessageDelimiter: '\\t',\n  logDateFormat: null,\n  logLayout: null,\n  logFile: null,\n  logFileMaxSize: 20480,\n  logFileBackups: 10,\n  logFileNameAbsolute: true,\n  logger: null\n});\n```\n\n#### logCacheSize\n\nAn array of recent log event messages is kept in `Logger.cache`. This specifies the size of that array.\n\nEnvironment variable __LOG_CACHE_SIZE__ overrides.\n\neg. `LOG_CACHE_SIZE=5000 node myServer.js`\n\n#### logLevel\n\noff, fatal, error, warn, info, debug, trace, all\n\nEnvironment variable __LOG_LEVEL__ overrides.\n\neg. `LOG_LEVEL=off node myServer.js`\n\n#### logTimeDelta\n\nLog the number of milliseconds since the previous log message.\n\n#### logStackTraces\n\nIf the last argument to the logger is an error, log the stack trace in a second message.\n\n#### logComponents\n\nAn array of log component names. Filters out all info, debug and trace messages from all component not in the list.\n\nEnvironment variable __LOG_COMPONENTS__ overrides.\n\neg. `LOG_COMPONENTS=component1,component2 node myServer.js`\n\n#### logMessageDelimiter\n\nThe delimiter appears between the timeDelta and the message.\n\n#### logDateFormat\n\nBy default no date appears in the log to console. However, dates are looged when the console is redirected (piped) to file. By specifying this format dates also be written to console.\n\neg. `'yyyy-MM-dd hh:mm:ss.SSS'`\n\n#### logLayout\n\nThis allows for specifying of the full log line layout. \n\neg.\n```javascript\n  ...\n  logLayout: {\n    type: 'pattern',\n    pattern: '%d{yyyy-MM-dd hh:mm:ss.SSS} [%[%5.5p%]] - %m'\n  },\n  ...\n```\n\n#### logFile\n\nIf specified - the logger logs to file and console. \n\n__Note: Using the file logger will in most cases fail to capture a logged fatal event that brought your server down. The file write is asynchronous and the exiting process does not wait. The log from console redirected to file will include the error because console writes are synchronous.__\n\n#### logFileMaxSize, logFileBackups\n\nLimit disk resources used by log file. This specifies how big the log file is allowed to get before 'archiving' it, and how many archive backups should be kept.\n\nIt creates `.log` (the current log), `.log.1` (the previous log), `.log.2` (older), etc\n\n#### logFileLayout\n\nSame as logLayout above - but for the logFile not the console.\n\n#### logFileNameAbsolute\n\nSpecifies if the specified logFile is an \"absolute\" filename. Don't know why it matters. It's a log4js parameter.\n\n#### logger\n\nEnables passing in a full log4js config. All log4js config fragments from the preceding list are ignored in favour of this full config.\n\neg.\n```javascript\n  ...\n  logger: {\n    appenders: [\n      {\n        type: \"console\",\n        layout: {\n          type: 'pattern',\n          pattern: '%d{yyyy-MM-dd hh:mm:ss.SSS} [%[%5.5p%]] - %m'\n        }\n      }\n    ]\n  },\n  ...\n```\n\n\n### Events\n\nThe logger emits an event before and after each log message. This enables console applications, terminals and similar to prepare for and/or recover from the logger performing a console write.\n\neg.\n```javascript\n\nLogger.emitter.on('before', function() {\n  // Runs immediately before every log write.\n});\n\nLogger.emitter.on('after', function() {\n  // Runs immediately after every log write.\n});\n\n//you can also listen for the actual log message and level\nLogger.emitter.on('after', function(level, message) {\n\n  //level = info|error|warn|debug\n  //message = 1ms<tab>hello\n\n});\n\n```\n\n","readmeFilename":"README.md","gitHead":"e7dce20cd6a8eaf7c6efe07b28d5fc063775288d","_id":"happn-logger@2.1.1-prerelease-1","_nodeVersion":"16.13.1","_npmVersion":"8.5.4","dist":{"integrity":"sha512-fiqVsgHi39c3F+KZ2hVtMcvZBUZmDBrijaB9VcBmVUdviSNIsv+fQGqyjoGPywDJ9mIYYkBZnhqb0u2MV6fXPA==","shasum":"c15252daf120c91826eb42c32e921728e704af59","tarball":"https://registry.npmjs.org/happn-logger/-/happn-logger-2.1.1-prerelease-1.tgz","fileCount":6,"unpackedSize":22895,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDwpodqlKKo9tc8rcMCc2N4zfiFPBjZFD5PTszrLlfvzAiBFIR+N7UrWGC9WcaXMPor67OwphZF+izQNGAWYunMylA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi0AP7ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpAJw//ZjZJXhWK/oF6AmjUBI8+HTv/I0z0P9Jkqqrhlc64cRegLXzy\r\nS4vdOfnihb7FS4PMGwoR0pV5PrUCO9QhOZ+i157UY0uDh+IVzQjhXbtRsle5\r\n9P0jPZFHuohYNJcYJftsAxYiXqWIxebTMdv8TSXsfzw5uM4aJgsSA1gx4jFa\r\n5lJKmZz+gkV+FM/lGCOywrkM6qO7DtsJj/jfL+r2pyBrMcc22/VPT5sjoSNx\r\nYwEWLzbEVuBTDkqCZt9DivfLR2P+Caz5ANoemTI9cJgWyXykXFuOv13jxPLi\r\nVv0Qr/Db0vWfS/50Nl5PJQwGzMXyckVtmiEBsgVsIlbcKvsyecdJVl5RQ/NA\r\n0zgZThAFbe2+dlXHPFJrIlGsFAiR6vJ4Hj/kwlI0AP86cEJ4ccqt4GUcZ4P6\r\nsl62B5QXSO8ojK5Qb1Pq988f6gpeBialoKHzxoXmDWskCyhl4ZlBg/ymzdCm\r\ndoUr5JjmGKQPVb1HqYfYy2L33gqSr3gRs0t4gv3uxG9fNKnKAhSQOIeINUgR\r\nZF3PFA6K1IAALA83m/VPq2ZzXasCxvMAXcn83jODmncA6KBG2eKhprXabawr\r\nTsN2IC4jAYy680HwefdE08Ywb2PbWP/+spwsFC3Qs6uqXVkKrZiz/blwOIxJ\r\n9PpdqeQh6E9tH8+AtUZWJoFkx/trj0/qHDQ=\r\n=zWpB\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"smc-tenacious","email":"eggers.jens@gmail.com"},"directories":{},"maintainers":[{"name":"nomilous","email":"nomilous@gmail.com"},{"name":"smc-tenacious","email":"eggers.jens@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/happn-logger_2.1.1-prerelease-1_1657799675694_0.04442180714991917"},"_hasShrinkwrap":false},"2.1.1-prerelease-2":{"name":"happn-logger","version":"2.1.1-prerelease-2","description":"Logger using log4js","main":"index.js","scripts":{"test":"_mocha --recursive --exit silence.js test/*","test-cover":"nyc --reporter=lcov --reporter=text-summary --reporter=html npm test"},"repository":{"type":"git","url":"git+https://github.com/happner/happn-logger.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/happner/happn-logger/issues"},"homepage":"https://github.com/happner/happn-logger#readme","devDependencies":{"capture-stdout":"^1.0.0","happn-commons-test":"^1.1.0-prerelease-2"},"dependencies":{"log4js":"^6.3.0"},"readme":"[![Build Status](https://travis-ci.org/happner/happn-logger.svg?branch=master)](https://travis-ci.org/happner/happn-logger)\n\n# happn-logger\n\n`npm install happn-logger --save`\n\nLogger using log4js.\n\nOne instance of the logger is shared processwide. (global)\n\n## Usage\n\nWith context and component.\n\n```javascript\nvar Logger = require('happn-logger');\nvar context = Logger.createContext('ContextName');\nvar log = context.createLogger('ComponentName');\n\nlog.info('message');\n// [ INFO] - 1ms    ContextName (ComponentName) message\n\n// log can create a new component logger in the same context\nvar log2 = log.createLogger('AnotherComponent');\n\n```\n\nWith component only.\n\n```javascript\nvar Logger = require('happn-logger');\nvar log = Logger.createLogger('ComponentName');\n\nlog.info('message');\n// [ INFO] - 1ms    (ComponentName) message\n```\n\nCreating log functions on existing object.\n\n```javascript\nvar Logger = require('happn-logger');\n\nvar thing = new Thing();\nLogger.createLogger('thing', thing);\n\nthing.info('message');\n// [ INFO] - 1ms    (thing) message\n```\n\n### Context\n\nThe context of the logger can be modified. The change is applied to all loggers in that context.\n\n```javascript\nvar Logger = require('happn-logger');\nvar logContext = Logger.createContext('ContextName');\nvar log1 = logContext.createLogger('ComponentName1');\nvar log2 = logContext.createLogger('ComponentName2');\n\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    ContextName (ComponentName1) message\n// [ INFO] - 0ms    ContextName (ComponentName2) message\n\nlogContext.context = 'Renamed';\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    Renamed (ComponentName1) message\n// [ INFO] - 0ms    Renamed (ComponentName2) message\n```\n\nThe context can be renamed from any one of the loggers and it will apply to all in the context.\n\n```javascript\nlog1.context('RenamedAgain');\n\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    RenamedAgain (ComponentName1) message\n// [ INFO] - 0ms    RenamedAgain (ComponentName2) message\n```\n\n### Format string\n\nWhen logging it is best not to pre-assemble the string to be logged because the cost of doing so is incurred even when the level being logged-to is not enabled.\n\neg. `log.debug('number: ' + theNumber);`\n\nInstead, use a format string in the first argument. The logger will perform the string assembly internally __only if the log level is enabled__.\n\neg. `log.debug('number: %d, string: %s, json: %j', theNumber, theString, theObject);`\n\n### Levels\n\n```javascript\nlog.fatal('message');\nlog.error('message');\nlog.warn('message');\nlog.info('message');\nlog.debug('message');\nlog.trace('message');\n\nlog.log('message'); // goes to debug\n```\n\nDebug and trace messages can also be logged as follows\n\n```javascript\nlog.$$DEBUG('message');\nlog.$$TRACE('message');\n```\n\nThis allows for confident matchability to enable substituting all debug and trace calls out of production deployments. \n\n### Configuration\n\n__It is important. The configure() must be called at least once.__\n\nShown with default values below.\n\n```javascript\nvar Logger = require('happn-logger');\n\nLogger.configure({\n  logCacheSize: 50,\n  logLevel: 'info',\n  logTimeDelta: true,\n  logStackTraces: true,\n  logComponents: [],\n  logMessageDelimiter: '\\t',\n  logDateFormat: null,\n  logLayout: null,\n  logFile: null,\n  logFileMaxSize: 20480,\n  logFileBackups: 10,\n  logFileNameAbsolute: true,\n  logger: null\n});\n```\n\n#### logCacheSize\n\nAn array of recent log event messages is kept in `Logger.cache`. This specifies the size of that array.\n\nEnvironment variable __LOG_CACHE_SIZE__ overrides.\n\neg. `LOG_CACHE_SIZE=5000 node myServer.js`\n\n#### logLevel\n\noff, fatal, error, warn, info, debug, trace, all\n\nEnvironment variable __LOG_LEVEL__ overrides.\n\neg. `LOG_LEVEL=off node myServer.js`\n\n#### logTimeDelta\n\nLog the number of milliseconds since the previous log message.\n\n#### logStackTraces\n\nIf the last argument to the logger is an error, log the stack trace in a second message.\n\n#### logComponents\n\nAn array of log component names. Filters out all info, debug and trace messages from all component not in the list.\n\nEnvironment variable __LOG_COMPONENTS__ overrides.\n\neg. `LOG_COMPONENTS=component1,component2 node myServer.js`\n\n#### logMessageDelimiter\n\nThe delimiter appears between the timeDelta and the message.\n\n#### logDateFormat\n\nBy default no date appears in the log to console. However, dates are looged when the console is redirected (piped) to file. By specifying this format dates also be written to console.\n\neg. `'yyyy-MM-dd hh:mm:ss.SSS'`\n\n#### logLayout\n\nThis allows for specifying of the full log line layout. \n\neg.\n```javascript\n  ...\n  logLayout: {\n    type: 'pattern',\n    pattern: '%d{yyyy-MM-dd hh:mm:ss.SSS} [%[%5.5p%]] - %m'\n  },\n  ...\n```\n\n#### logFile\n\nIf specified - the logger logs to file and console. \n\n__Note: Using the file logger will in most cases fail to capture a logged fatal event that brought your server down. The file write is asynchronous and the exiting process does not wait. The log from console redirected to file will include the error because console writes are synchronous.__\n\n#### logFileMaxSize, logFileBackups\n\nLimit disk resources used by log file. This specifies how big the log file is allowed to get before 'archiving' it, and how many archive backups should be kept.\n\nIt creates `.log` (the current log), `.log.1` (the previous log), `.log.2` (older), etc\n\n#### logFileLayout\n\nSame as logLayout above - but for the logFile not the console.\n\n#### logFileNameAbsolute\n\nSpecifies if the specified logFile is an \"absolute\" filename. Don't know why it matters. It's a log4js parameter.\n\n#### logger\n\nEnables passing in a full log4js config. All log4js config fragments from the preceding list are ignored in favour of this full config.\n\neg.\n```javascript\n  ...\n  logger: {\n    appenders: [\n      {\n        type: \"console\",\n        layout: {\n          type: 'pattern',\n          pattern: '%d{yyyy-MM-dd hh:mm:ss.SSS} [%[%5.5p%]] - %m'\n        }\n      }\n    ]\n  },\n  ...\n```\n\n\n### Events\n\nThe logger emits an event before and after each log message. This enables console applications, terminals and similar to prepare for and/or recover from the logger performing a console write.\n\neg.\n```javascript\n\nLogger.emitter.on('before', function() {\n  // Runs immediately before every log write.\n});\n\nLogger.emitter.on('after', function() {\n  // Runs immediately after every log write.\n});\n\n//you can also listen for the actual log message and level\nLogger.emitter.on('after', function(level, message) {\n\n  //level = info|error|warn|debug\n  //message = 1ms<tab>hello\n\n});\n\n```\n\n","readmeFilename":"README.md","gitHead":"fc3961fb73d4c2caaa5dddcde713073e377b665a","_id":"happn-logger@2.1.1-prerelease-2","_nodeVersion":"16.13.1","_npmVersion":"8.5.4","dist":{"integrity":"sha512-iReOdlcHWyrrcl7lUSwURRyzT1JuGwN814rIOHoK2FXhbJ/pwrSrl/rWl5FrlLrQj1PurqSEUcRD+YnKLn4Kow==","shasum":"cf0ae21108efc586733520cced3c2a9564b98df3","tarball":"https://registry.npmjs.org/happn-logger/-/happn-logger-2.1.1-prerelease-2.tgz","fileCount":6,"unpackedSize":22895,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF7DXRTiLtxRUNztBBk2lp6ETqKTgRaAJ3tdexuK0lgVAiEArT6Q3gXSKsSQdy73N6x8lExBJpY40LtXFszMeF5r0Pk="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi0B5wACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqOkA//WfetQgrZ/gtHH0rrssK9XW8mYrijmJUiwBbbGQun15A/u5q3\r\n7DwZ/lbxgoz5qX04NvIjq0+P2mdai+C51JMK/V7970hxOxGBmBZo3S6QEGnX\r\nJ3QszcWyMsrb8AHHbF+IdJefL9HxWAApQgFno8L3DwdTd/jy7BAMIU9UTlfF\r\nQjha4ehsQA8zfP+EhLZQodiKkfW2gJJZXWJhAoPUdb4oK0yBNBEwvmcY6Awk\r\nxXH2SqFDADKZGa98Wo7fx/EsB0JoiTD8nl7hQXed8y7duj93q7I06oIBTjrj\r\nDdlCHAIzLC3Kp8w2L4ZlCtYn+3siFNgda8lOLX6blqg9KkUIE7ti/n2rXher\r\n4ZtfdVwZJvlaSMtytPRgZov6c2ZZxwtHoSdo9ylGliwyIGYQ5ridUZ7bBOH6\r\nhv/ujmnsWjXYeBMJ5wqAml6enVM0sJKnTp/xkfRPeVYW+N+zpbtsgud9naMl\r\n8UwmTT8xG4juiJomsdolCz4l17ahLeiY4Afym6FwaGfE1eSOlv+ys8hV7jAo\r\n0aaafnyBEcSRQE6ZUJEovwlktdPW5uNzPa2vwP+vPWAJofzZ3YhdPPRTMKV3\r\n5v+SWX+uUdo9MKnvdhxlRGDgu9I5bzqLbl67RxMUMiAYR1+zJQ2tlCleVQ3r\r\nlohiVRyXyNodu+FX3J6aGACBdi525vpdZRY=\r\n=lZS0\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"smc-tenacious","email":"eggers.jens@gmail.com"},"directories":{},"maintainers":[{"name":"nomilous","email":"nomilous@gmail.com"},{"name":"smc-tenacious","email":"eggers.jens@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/happn-logger_2.1.1-prerelease-2_1657806448575_0.72595230733334"},"_hasShrinkwrap":false},"2.1.1":{"name":"happn-logger","version":"2.1.1","description":"Logger using log4js","main":"index.js","scripts":{"test":"_mocha --recursive --exit silence.js test/*","test-cover":"nyc --reporter=lcov --reporter=text-summary --reporter=html npm test"},"repository":{"type":"git","url":"git+https://github.com/happner/happn-logger.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/happner/happn-logger/issues"},"homepage":"https://github.com/happner/happn-logger#readme","devDependencies":{"capture-stdout":"^1.0.0","happn-commons-test":"^1.1.0"},"dependencies":{"log4js":"^6.3.0"},"gitHead":"62047eaa0a0e687561a12e041ba27f2eef3a5123","_id":"happn-logger@2.1.1","_nodeVersion":"16.13.1","_npmVersion":"8.5.4","dist":{"integrity":"sha512-6ps+Qw0hMIMvv3xNeXC2eFiT9OFlknEYTxfV1nmLVKX6Z4XdGgeISNagABOAM+ZJN7kdlX8FtCqYG01ZND8S7A==","shasum":"24545157009a84475f1020bf8fd9d2421a3ef0b8","tarball":"https://registry.npmjs.org/happn-logger/-/happn-logger-2.1.1.tgz","fileCount":6,"unpackedSize":22869,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDwqJzkB9+7Wo6LxPO+BFtWafzGON5+I/TUd4q1/YAGSQIgDachC97xNrOrHpEU21Dj7nu4axVRIT0PG/IskIpXxKg="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi2QhnACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoF3BAAly2hUxNiCbw2SPmhO9MrF63XA2UcroC6S7w6XeOGIxs2U4GU\r\nXlA2zGsj2oMdzrjrCln1Hr82w8j/lq2oCR/nAAQNRXADdGA5flnoTW8S72O8\r\nPe8miJe/OuD924lC91rSr1/GkEc9oct3c2i6+6B4q6K4iYYm+Dw9qYByfXNX\r\nMdfu25SczSivqRAMmXODma7pc7aIZ4o/wvBPOcebOTsRx81IK9rzxP1yuZEq\r\nvczVYvEqg7J8kvlLtxX81X9PeQ9jADJ9UT9E3f23fDnhH7FoL1HiJO0yx+EG\r\n5i70x9h4p+s0s9uhs7KsB/41k78EN5VakuGgdVFA/LfNkRqaIATG2hbl3uvk\r\njxoE1DK0bPW/aN9Ombv5jgReF4fl2etxrAkzAVdkq3Mk5PKHe6/aKNpjR7aZ\r\nxsPS9mtLcfNeF9+kmU0DhIXH5o1GW+cFkG4Wv9QdScFezXuscfEtQj+Q++rd\r\n7Y/Y+bx0BFY0BYW/XbWN9h8LWsNl2RSO2oYeVwRUBpoJAJ6xnxLF2NhoDseW\r\nzFZNyYNTrXQbMwsut3xalBHsiRJT+MDH0vUOIBCehL1uDuC9DC4Wb4G6xLjS\r\nibNxl2FkAdN3lreBpnGvjgyj/fQqLVJrCVSsC/MbN5FhDuCXqzO5ZqSz8mwi\r\nDU16Lgdh12iydwM6ABiuvmOP1hgQg/zMTs0=\r\n=dFuC\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"smc-tenacious","email":"eggers.jens@gmail.com"},"directories":{},"maintainers":[{"name":"nomilous","email":"nomilous@gmail.com"},{"name":"smc-tenacious","email":"eggers.jens@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/happn-logger_2.1.1_1658390631384_0.5431411558140864"},"_hasShrinkwrap":false},"2.2.0-prerelease-2":{"name":"happn-logger","version":"2.2.0-prerelease-2","description":"Logger using log4js","main":"index.js","scripts":{"test":"_mocha --recursive --exit silence.js test/*","test-cover":"nyc --reporter=lcov --reporter=text-summary --reporter=html npm test"},"repository":{"type":"git","url":"git+https://github.com/happner/happn-logger.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/happner/happn-logger/issues"},"homepage":"https://github.com/happner/happn-logger#readme","devDependencies":{"capture-stdout":"^1.0.0","happn-commons-test":"^1.1.0"},"dependencies":{"log4js":"^6.3.0"},"readme":"[![Build Status](https://travis-ci.org/happner/happn-logger.svg?branch=master)](https://travis-ci.org/happner/happn-logger)\n\n# happn-logger\n\n`npm install happn-logger --save`\n\nLogger using log4js.\n\nOne instance of the logger is shared processwide. (global)\n\n## Usage\n\nWith context and component.\n\n```javascript\nvar Logger = require('happn-logger');\nvar context = Logger.createContext('ContextName');\nvar log = context.createLogger('ComponentName');\n\nlog.info('message');\n// [ INFO] - 1ms    ContextName (ComponentName) message\n\n// log can create a new component logger in the same context\nvar log2 = log.createLogger('AnotherComponent');\n\n```\n\nWith component only.\n\n```javascript\nvar Logger = require('happn-logger');\nvar log = Logger.createLogger('ComponentName');\n\nlog.info('message');\n// [ INFO] - 1ms    (ComponentName) message\n```\n\nCreating log functions on existing object.\n\n```javascript\nvar Logger = require('happn-logger');\n\nvar thing = new Thing();\nLogger.createLogger('thing', thing);\n\nthing.info('message');\n// [ INFO] - 1ms    (thing) message\n```\n\n### Context\n\nThe context of the logger can be modified. The change is applied to all loggers in that context.\n\n```javascript\nvar Logger = require('happn-logger');\nvar logContext = Logger.createContext('ContextName');\nvar log1 = logContext.createLogger('ComponentName1');\nvar log2 = logContext.createLogger('ComponentName2');\n\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    ContextName (ComponentName1) message\n// [ INFO] - 0ms    ContextName (ComponentName2) message\n\nlogContext.context = 'Renamed';\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    Renamed (ComponentName1) message\n// [ INFO] - 0ms    Renamed (ComponentName2) message\n```\n\nThe context can be renamed from any one of the loggers and it will apply to all in the context.\n\n```javascript\nlog1.context('RenamedAgain');\n\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    RenamedAgain (ComponentName1) message\n// [ INFO] - 0ms    RenamedAgain (ComponentName2) message\n```\n\n### Format string\n\nWhen logging it is best not to pre-assemble the string to be logged because the cost of doing so is incurred even when the level being logged-to is not enabled.\n\neg. `log.debug('number: ' + theNumber);`\n\nInstead, use a format string in the first argument. The logger will perform the string assembly internally __only if the log level is enabled__.\n\neg. `log.debug('number: %d, string: %s, json: %j', theNumber, theString, theObject);`\n\n### Levels\n\n```javascript\nlog.fatal('message');\nlog.error('message');\nlog.warn('message');\nlog.info('message');\nlog.debug('message');\nlog.trace('message');\n\nlog.log('message'); // goes to debug\n```\n\nDebug and trace messages can also be logged as follows\n\n```javascript\nlog.$$DEBUG('message');\nlog.$$TRACE('message');\n```\n\nThis allows for confident matchability to enable substituting all debug and trace calls out of production deployments. \n\n### Configuration\n\n__It is important. The configure() must be called at least once.__\n\nShown with default values below.\n\n```javascript\nvar Logger = require('happn-logger');\n\nLogger.configure({\n  logCacheSize: 50,\n  logLevel: 'info',\n  logTimeDelta: true,\n  logStackTraces: true,\n  logComponents: [],\n  logMessageDelimiter: '\\t',\n  logDateFormat: null,\n  logLayout: null,\n  logFile: null,\n  logFileMaxSize: 20480,\n  logFileBackups: 10,\n  logFileNameAbsolute: true,\n  logger: null\n});\n```\n\n#### logCacheSize\n\nAn array of recent log event messages is kept in `Logger.cache`. This specifies the size of that array.\n\nEnvironment variable __LOG_CACHE_SIZE__ overrides.\n\neg. `LOG_CACHE_SIZE=5000 node myServer.js`\n\n#### logLevel\n\noff, fatal, error, warn, info, debug, trace, all\n\nEnvironment variable __LOG_LEVEL__ overrides.\n\neg. `LOG_LEVEL=off node myServer.js`\n\n#### logTimeDelta\n\nLog the number of milliseconds since the previous log message.\n\n#### logStackTraces\n\nIf the last argument to the logger is an error, log the stack trace in a second message.\n\n#### logComponents\n\nAn array of log component names. Filters out all info, debug and trace messages from all component not in the list.\n\nEnvironment variable __LOG_COMPONENTS__ overrides.\n\neg. `LOG_COMPONENTS=component1,component2 node myServer.js`\n\n#### logMessageDelimiter\n\nThe delimiter appears between the timeDelta and the message.\n\n#### logDateFormat\n\nBy default no date appears in the log to console. However, dates are looged when the console is redirected (piped) to file. By specifying this format dates also be written to console.\n\neg. `'yyyy-MM-dd hh:mm:ss.SSS'`\n\n#### logLayout\n\nThis allows for specifying of the full log line layout. \n\neg.\n```javascript\n  ...\n  logLayout: {\n    type: 'pattern',\n    pattern: '%d{yyyy-MM-dd hh:mm:ss.SSS} [%[%5.5p%]] - %m'\n  },\n  ...\n```\n\n#### logFile\n\nIf specified - the logger logs to file and console. \n\n__Note: Using the file logger will in most cases fail to capture a logged fatal event that brought your server down. The file write is asynchronous and the exiting process does not wait. The log from console redirected to file will include the error because console writes are synchronous.__\n\n#### logFileMaxSize, logFileBackups\n\nLimit disk resources used by log file. This specifies how big the log file is allowed to get before 'archiving' it, and how many archive backups should be kept.\n\nIt creates `.log` (the current log), `.log.1` (the previous log), `.log.2` (older), etc\n\n#### logFileLayout\n\nSame as logLayout above - but for the logFile not the console.\n\n#### logFileNameAbsolute\n\nSpecifies if the specified logFile is an \"absolute\" filename. Don't know why it matters. It's a log4js parameter.\n\n#### logger\n\nEnables passing in a full log4js config. All log4js config fragments from the preceding list are ignored in favour of this full config.\n\neg.\n```javascript\n  ...\n  logger: {\n    appenders: [\n      {\n        type: \"console\",\n        layout: {\n          type: 'pattern',\n          pattern: '%d{yyyy-MM-dd hh:mm:ss.SSS} [%[%5.5p%]] - %m'\n        }\n      }\n    ]\n  },\n  ...\n```\n\n\n### Events\n\nThe logger emits an event before and after each log message. This enables console applications, terminals and similar to prepare for and/or recover from the logger performing a console write.\n\neg.\n```javascript\n\nLogger.emitter.on('before', function() {\n  // Runs immediately before every log write.\n});\n\nLogger.emitter.on('after', function() {\n  // Runs immediately after every log write.\n});\n\n//you can also listen for the actual log message and level\nLogger.emitter.on('after', function(level, message) {\n\n  //level = info|error|warn|debug\n  //message = 1ms<tab>hello\n\n});\n\n```\n\n","readmeFilename":"README.md","gitHead":"c2692bf12f40a4029b1db265ff639324458a4ce5","_id":"happn-logger@2.2.0-prerelease-2","_nodeVersion":"16.13.1","_npmVersion":"8.5.4","dist":{"integrity":"sha512-D5/u1YTH5/dtnRBy/dF9z9VuNqFWnLSkQLJhcCE2boYPrOgKstPorVRBuRBeMAQGKf+LEfSsgug22GDySjFcUw==","shasum":"21c28166c68c286720657ffa03509429a770b67c","tarball":"https://registry.npmjs.org/happn-logger/-/happn-logger-2.2.0-prerelease-2.tgz","fileCount":6,"unpackedSize":23008,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCtlp8ptsUX02cA0MQf27WuetG3E8mmCUODIqR95yhqzwIgaULiT+A5vcTJufwVY+qkZKZzVd+SArfVad3zeDx8CwA="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjGbhnACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrg+g//Sx9UBkeWKlCYcYuTggQuNZz/MYWYP4QcpD12Ek4E8Ol50XlM\r\nLO8qX+MNlGCyyZ+aRIHKZykU8nHYc1KtADH8iN5+vs8MbtKul5KGmZMT2ILd\r\nWzASwp/mlbvoEvGrNWbRAlFGqOJTAH/vcSd5NryQN6EDhp9rBlmvHT1UxiYu\r\neIdc/Dx9TTkkuea/qb9AXSDyYxlyARbUL0Hoxa1AySKdunvWcCOAs/vSEe0L\r\nQc9v2YMJIYkOJPIcfsttE7iinAsgLQmNRxxwRZwKulSbPDOqMveD5QteJy8/\r\n5kzSZ32XVY+QngxtKeP5LOp+q5jwQoWgZHmDwNO2OeBpeWWjls+0hcsIEGlF\r\nSZxebPt7CHJLhcV1a4vK47XtvtkGYcxohyR24Btq/XNXURg9WvZ/Sorczj9I\r\nX+V6MU0Rl2zw8xb2QctXxu9MaU+fjHbofYx/xI7i+oT3gcKTSYqayRdSk1j6\r\nb2TARF2DtnqvBxobQgrMXbui5/b7KYBLnS0rTHuc2oQDb8eOOhTQ17WJtAoe\r\nvrQQSafG8BsKQSdZrjD8N+HY1sbmY2JUAJZotMzPuDh7DhJvHa40rJOfr5vg\r\n64Ie1KUrnD68WqV1xTfi125ZSq83tBqrLYFC1nXym2doOMh+EBbA/A4dZVSW\r\n6vXr3hQEQ0oSY+AHKBy1y4K9dmRXG8bcgyc=\r\n=Mhb7\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"simonbishopza","email":"simon.bishop.za@gmail.com"},"directories":{},"maintainers":[{"name":"nomilous","email":"nomilous@gmail.com"},{"name":"smc-tenacious","email":"eggers.jens@gmail.com"},{"name":"simonbishopza","email":"simon.bishop.za@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/happn-logger_2.2.0-prerelease-2_1662629991521_0.5593078156129465"},"_hasShrinkwrap":false},"2.2.0-prerelease-3":{"name":"happn-logger","version":"2.2.0-prerelease-3","description":"Logger using log4js","main":"index.js","scripts":{"test":"_mocha --recursive --exit silence.js test/*","test-cover":"nyc --reporter=lcov --reporter=text-summary --reporter=html npm test"},"repository":{"type":"git","url":"git+https://github.com/happner/happn-logger.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/happner/happn-logger/issues"},"homepage":"https://github.com/happner/happn-logger#readme","devDependencies":{"capture-stdout":"^1.0.0","happn-commons-test":"^1.1.0"},"dependencies":{"log4js":"^6.3.0"},"readme":"[![Build Status](https://travis-ci.org/happner/happn-logger.svg?branch=master)](https://travis-ci.org/happner/happn-logger)\n\n# happn-logger\n\n`npm install happn-logger --save`\n\nLogger using log4js.\n\nOne instance of the logger is shared processwide. (global)\n\n## Usage\n\nWith context and component.\n\n```javascript\nvar Logger = require('happn-logger');\nvar context = Logger.createContext('ContextName');\nvar log = context.createLogger('ComponentName');\n\nlog.info('message');\n// [ INFO] - 1ms    ContextName (ComponentName) message\n\n// log can create a new component logger in the same context\nvar log2 = log.createLogger('AnotherComponent');\n\n```\n\nWith component only.\n\n```javascript\nvar Logger = require('happn-logger');\nvar log = Logger.createLogger('ComponentName');\n\nlog.info('message');\n// [ INFO] - 1ms    (ComponentName) message\n```\n\nCreating log functions on existing object.\n\n```javascript\nvar Logger = require('happn-logger');\n\nvar thing = new Thing();\nLogger.createLogger('thing', thing);\n\nthing.info('message');\n// [ INFO] - 1ms    (thing) message\n```\n\n### Context\n\nThe context of the logger can be modified. The change is applied to all loggers in that context.\n\n```javascript\nvar Logger = require('happn-logger');\nvar logContext = Logger.createContext('ContextName');\nvar log1 = logContext.createLogger('ComponentName1');\nvar log2 = logContext.createLogger('ComponentName2');\n\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    ContextName (ComponentName1) message\n// [ INFO] - 0ms    ContextName (ComponentName2) message\n\nlogContext.context = 'Renamed';\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    Renamed (ComponentName1) message\n// [ INFO] - 0ms    Renamed (ComponentName2) message\n```\n\nThe context can be renamed from any one of the loggers and it will apply to all in the context.\n\n```javascript\nlog1.context('RenamedAgain');\n\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    RenamedAgain (ComponentName1) message\n// [ INFO] - 0ms    RenamedAgain (ComponentName2) message\n```\n\n### Format string\n\nWhen logging it is best not to pre-assemble the string to be logged because the cost of doing so is incurred even when the level being logged-to is not enabled.\n\neg. `log.debug('number: ' + theNumber);`\n\nInstead, use a format string in the first argument. The logger will perform the string assembly internally __only if the log level is enabled__.\n\neg. `log.debug('number: %d, string: %s, json: %j', theNumber, theString, theObject);`\n\n### Levels\n\n```javascript\nlog.fatal('message');\nlog.error('message');\nlog.warn('message');\nlog.info('message');\nlog.debug('message');\nlog.trace('message');\n\nlog.log('message'); // goes to debug\n```\n\nDebug and trace messages can also be logged as follows\n\n```javascript\nlog.$$DEBUG('message');\nlog.$$TRACE('message');\n```\n\nThis allows for confident matchability to enable substituting all debug and trace calls out of production deployments. \n\n### Configuration\n\n__It is important. The configure() must be called at least once.__\n\nShown with default values below.\n\n```javascript\nvar Logger = require('happn-logger');\n\nLogger.configure({\n  logCacheSize: 50,\n  logLevel: 'info',\n  logTimeDelta: true,\n  logStackTraces: true,\n  logComponents: [],\n  logMessageDelimiter: '\\t',\n  logDateFormat: null,\n  logLayout: null,\n  logFile: null,\n  logFileMaxSize: 20480,\n  logFileBackups: 10,\n  logFileNameAbsolute: true,\n  logger: null\n});\n```\n\n#### logCacheSize\n\nAn array of recent log event messages is kept in `Logger.cache`. This specifies the size of that array.\n\nEnvironment variable __LOG_CACHE_SIZE__ overrides.\n\neg. `LOG_CACHE_SIZE=5000 node myServer.js`\n\n#### logLevel\n\noff, fatal, error, warn, info, debug, trace, all\n\nEnvironment variable __LOG_LEVEL__ overrides.\n\neg. `LOG_LEVEL=off node myServer.js`\n\n#### logTimeDelta\n\nLog the number of milliseconds since the previous log message.\n\n#### logStackTraces\n\nIf the last argument to the logger is an error, log the stack trace in a second message.\n\n#### logComponents\n\nAn array of log component names. Filters out all info, debug and trace messages from all component not in the list.\n\nEnvironment variable __LOG_COMPONENTS__ overrides.\n\neg. `LOG_COMPONENTS=component1,component2 node myServer.js`\n\n#### logMessageDelimiter\n\nThe delimiter appears between the timeDelta and the message.\n\n#### logDateFormat\n\nBy default no date appears in the log to console. However, dates are looged when the console is redirected (piped) to file. By specifying this format dates also be written to console.\n\neg. `'yyyy-MM-dd hh:mm:ss.SSS'`\n\n#### logLayout\n\nThis allows for specifying of the full log line layout. \n\neg.\n```javascript\n  ...\n  logLayout: {\n    type: 'pattern',\n    pattern: '%d{yyyy-MM-dd hh:mm:ss.SSS} [%[%5.5p%]] - %m'\n  },\n  ...\n```\n\n#### logFile\n\nIf specified - the logger logs to file and console. \n\n__Note: Using the file logger will in most cases fail to capture a logged fatal event that brought your server down. The file write is asynchronous and the exiting process does not wait. The log from console redirected to file will include the error because console writes are synchronous.__\n\n#### logFileMaxSize, logFileBackups\n\nLimit disk resources used by log file. This specifies how big the log file is allowed to get before 'archiving' it, and how many archive backups should be kept.\n\nIt creates `.log` (the current log), `.log.1` (the previous log), `.log.2` (older), etc\n\n#### logFileLayout\n\nSame as logLayout above - but for the logFile not the console.\n\n#### logFileNameAbsolute\n\nSpecifies if the specified logFile is an \"absolute\" filename. Don't know why it matters. It's a log4js parameter.\n\n#### logger\n\nEnables passing in a full log4js config. All log4js config fragments from the preceding list are ignored in favour of this full config.\n\neg.\n```javascript\n  ...\n  logger: {\n    appenders: [\n      {\n        type: \"console\",\n        layout: {\n          type: 'pattern',\n          pattern: '%d{yyyy-MM-dd hh:mm:ss.SSS} [%[%5.5p%]] - %m'\n        }\n      }\n    ]\n  },\n  ...\n```\n\n\n### Events\n\nThe logger emits an event before and after each log message. This enables console applications, terminals and similar to prepare for and/or recover from the logger performing a console write.\n\neg.\n```javascript\n\nLogger.emitter.on('before', function() {\n  // Runs immediately before every log write.\n});\n\nLogger.emitter.on('after', function() {\n  // Runs immediately after every log write.\n});\n\n//you can also listen for the actual log message and level\nLogger.emitter.on('after', function(level, message) {\n\n  //level = info|error|warn|debug\n  //message = 1ms<tab>hello\n\n});\n\n```\n\n","readmeFilename":"README.md","gitHead":"dbf146aec79fe4b2511a72c2050d097b862fcaf4","_id":"happn-logger@2.2.0-prerelease-3","_nodeVersion":"16.13.1","_npmVersion":"8.5.4","dist":{"integrity":"sha512-EX4IPqJHndJ3oCAp8bXObyquwdgzBGPDdeSIkO8j4wGXMdFn6o8sqDmP1jpz2GyyHYfqGH17c56HWDzq+HXS1w==","shasum":"306effc8fb6ed165c07b71f93b8f71a828011416","tarball":"https://registry.npmjs.org/happn-logger/-/happn-logger-2.2.0-prerelease-3.tgz","fileCount":6,"unpackedSize":23008,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC0D6LWjho/ikub9nAOLM5AQEH4XLOkFFliBgYZrar+pwIhAIOMBZBjlDrafqhQBtlfB28TeooY2wAe6lwJccDJNpWW"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjGfJtACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrxPg/+JewSoiHLpPmmBzNDeJHIk1zlOpMU+g/Gsbn7vlSyuv/ccJwu\r\nF0UesX2d8oKc77dWXUDy9E+fSzp1+u3MMlcAXMyTaT3z1nac0WXIYfmPCf0Q\r\nrREckHBxKVlnsNSliM3qagYxtvN52tv6XY6EeOHEh99Wnh1mak+zaMIbmgzQ\r\ni74QE5PJZLQNhfOfb9AUaAqa8XyflrUCQ3jgA1K+iKTEoCqqMWq2R4ebPZNd\r\nKQrUy5WYKlM7QgEwd1o75C6i8BAWLKqm0QpwujfBlCOjIKOkPdpNIZfBK+l5\r\n74WC7YHPEq/GSrK+aYvtsDx97keD1HmNjRrGJgTEQOTSu8lYpU6w1w7l4zw0\r\nzCpclR+2br5z0Bbb5QNs0+0AxyYx8mUT1oZQClUCPetcYX62MyEnX+WRrDFG\r\nvy6HXq4wj2NUIgK300NaS/7ePTVzhhuYgvsWjrRAuRgbInWMqxzkUmkoQROl\r\nYnMiyMcUVtWwDK+geYetWY7vpB5d+bWFX6TJYrNwMMNV8VKghM36WjgWzsXh\r\n9iS0Ud0yr/AYVBTBYuvoTofxV4Rj+Sc6W5a9Od2BYbDSrdcWlHSdI4W+f+Z8\r\nOpHI0bx+WBYytSw06IA6eB+iUzVDczPgfd0/CDNyw1SYAB9mRHD0MZPKmyuo\r\nqm6M9rEjfut8IDOCljya5ZC6bQ2lChjBU64=\r\n=3bj1\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"simonbishopza","email":"simon.bishop.za@gmail.com"},"directories":{},"maintainers":[{"name":"nomilous","email":"nomilous@gmail.com"},{"name":"smc-tenacious","email":"eggers.jens@gmail.com"},{"name":"simonbishopza","email":"simon.bishop.za@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/happn-logger_2.2.0-prerelease-3_1662644844955_0.8210396617180014"},"_hasShrinkwrap":false},"2.2.0":{"name":"happn-logger","version":"2.2.0","description":"Logger using log4js","main":"index.js","scripts":{"test":"_mocha --recursive --exit silence.js test/*","test-cover":"nyc --reporter=lcov --reporter=text-summary --reporter=html npm test"},"repository":{"type":"git","url":"git+https://github.com/happner/happn-logger.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/happner/happn-logger/issues"},"homepage":"https://github.com/happner/happn-logger#readme","devDependencies":{"capture-stdout":"^1.0.0","happn-commons-test":"^1.1.0"},"dependencies":{"log4js":"^6.3.0"},"gitHead":"09c282e829c2716d45bef015f431815bb01ea8f6","_id":"happn-logger@2.2.0","_nodeVersion":"16.13.1","_npmVersion":"8.5.4","dist":{"integrity":"sha512-g3avatudTaRc4HIF0Z42YGDLJPI/a+0qT7sPtV41NbhxvKknll/l0PUOrEs4Dh7YiMNd0j9UpB+7h6OZTsD7Vg==","shasum":"0f7c65c197bf4690ea3e5f25057329392aecef0d","tarball":"https://registry.npmjs.org/happn-logger/-/happn-logger-2.2.0.tgz","fileCount":6,"unpackedSize":22995,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDwiThN/OGaNH4YFtKyPa1+E6ew67adhZE06HUzThndogIgReOc1pPh1Z24psRjKKoDuAR7oCGpWL6Gxmm3UmNL94g="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjIGwJACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpWGw//UFPiiVL7kzoanUnovFLG3gSHlEY9MFLg2/oZM3PGYG0XNRdB\r\nr/0WvJGny5cHG9y/0j+OKOP+WaxLrbdarBpb+vAfigj0HI+YOYUwitqzlDXc\r\nqVlPkUMK9OMQsfvUz8wG8cwxxNL26Yilcz93hmnNcDUD6XMEkPhZlpiLah8X\r\nHqGLIhpMjNuBdFQEcRpULQ0Yt78j/YDL/6hh8UjObcgy9NcQAM83sF3RSwDC\r\naZWtM5IiDnKckI/HWdnxGI7YOksnzak6yebsSnB/qspGaoNn+jDi32+XntYg\r\nEFTJzSViL3YX5ISQhm+1cjPpxXLquMrzlvVgMgtMoGpDRxB8T0dQhzTYW3u2\r\nJLtZx5Dg8E51UifjF9NiXB0/29d2qdTUfMSfxEo5vLTWAsEZi2lGieuk45BA\r\n8hLw6YOficD7NmGgCV54+0WZjEMAcQr9ywP51IvG5BGBblTiI/vJk9B6ayq3\r\n74B/8YO/7AKEyQYfz30W3LBiDwL4adL4dXY6RhwomopMZ4vFfsmMnms22t1q\r\nenhHpBhOaKngEgnTjPekyMMVD2YlNH78fVFiaO7RsqGNlmq5Eifqo4fH6dkf\r\nE2I83jR66CWtfy4EEzt9MUGDex2SPWAtn/w9r8Z4ZdPQLVFOXmvplelZy5Q6\r\nTAAMxJ58XMKtglpaSMEYwr7BoAIZL0QUpVU=\r\n=2P8C\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"simonbishopza","email":"simon.bishop.za@gmail.com"},"directories":{},"maintainers":[{"name":"nomilous","email":"nomilous@gmail.com"},{"name":"smc-tenacious","email":"eggers.jens@gmail.com"},{"name":"simonbishopza","email":"simon.bishop.za@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/happn-logger_2.2.0_1663069193268_0.3767495649845003"},"_hasShrinkwrap":false},"2.2.1":{"name":"happn-logger","version":"2.2.1","description":"Logger using log4js","main":"index.js","scripts":{"test":"_mocha --recursive --exit silence.js test/*","test-cover":"nyc --reporter=lcov --reporter=text-summary --reporter=html npm test"},"repository":{"type":"git","url":"git+https://github.com/happner/happn-logger.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/happner/happn-logger/issues"},"homepage":"https://github.com/happner/happn-logger#readme","devDependencies":{"capture-stdout":"^1.0.0","happn-commons-test":"1.1.1"},"dependencies":{"log4js":"^6.3.0"},"gitHead":"c4297a23b1837ca4a5a9aebf9c4cee0c47bea12a","_id":"happn-logger@2.2.1","_nodeVersion":"16.13.1","_npmVersion":"8.5.4","dist":{"integrity":"sha512-1s/KM0KIm5MF7OpV2/kSGluugUvqUUgEXwSLpy1ViqOLNtNYk7m39LSy17OGL9LLs0G+dQFTFXJlaSlyC3tcIg==","shasum":"928b850bb9002105bcd30c648d2811a5dbd23329","tarball":"https://registry.npmjs.org/happn-logger/-/happn-logger-2.2.1.tgz","fileCount":6,"unpackedSize":23189,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD/KDqzmKbgZV0JAA4ApvECN9svT3dKb6A6bo1LMiJ0VAIhAJI7AUH7C/WPLSW0daoecXqg6Fr01HWx4h8mxODp0ZR8"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjYSYbACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqabw//SwiIScntKPnG39ycSmcuyjGvwATyCJMp7b8s1Q46c7WMqkx9\r\n4FQiDjMKeuntuG7fo/WcDdzWCUkgeQgEIloVYLwdxNv5NIyOaCZU/JNyn6Fv\r\nI3H3rkLQ6MfLuszQGBEWe9LT2sLSU8ggrCO/2POcj55oekfUzlmLc1IFTSXf\r\nznCzky9zI2YwClXFIEumn2FLPxb+55Vcmqj+wr7aBbs+hT+hKtQ/TXI+Tron\r\n5/bzh7WTHzCxcr4JazPnb+b8aPOAMjb/KJONqOKJCUULGhGyr8/k4ZOw2G3y\r\nC9EJjxaCMLIxSDwHjTeVR1FJpGXHEgxlq24OZygRZmRTH2Chnwqx6BhYoGoi\r\nA4vPEgXiURZlAgYOCKWT6UBn91tFwaPpPwkC3NbhqdxxURhdySW3StIrTOLR\r\n8VB7bOekLRKqZY34n4WPcS1Qt6pMUEyjnWUmTkjSYmizVqSbOiTpf0MqsvgJ\r\nEn2eC9Hn+nsUI1+uF1gYua44dvZfZxlZ4RYnnro4CODRBp3CmZfbhznJOd70\r\ndD0NW4m1CJj+Cce8Sfvf37zZckSHX5og4PLfMUwqim7rhV5PKwH333fT0bFP\r\nLFXEM5kgklHeAzOgzytvWDSpV26UXbO6J+TnRaRzifzcN7sWqDtKUzq595tA\r\n6mf1u05cR4iHevQa3E8NKGC8QNtrXFsKA1o=\r\n=SCn+\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"simonbishopza","email":"simon.bishop.za@gmail.com"},"directories":{},"maintainers":[{"name":"nomilous","email":"nomilous@gmail.com"},{"name":"smc-tenacious","email":"eggers.jens@gmail.com"},{"name":"simonbishopza","email":"simon.bishop.za@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/happn-logger_2.2.1_1667311131732_0.35498835176666277"},"_hasShrinkwrap":false},"2.2.2":{"name":"happn-logger","version":"2.2.2","description":"Logger using log4js","main":"index.js","scripts":{"test":"_mocha --recursive --exit silence.js test/*","test-cover":"nyc --reporter=lcov --reporter=text-summary --reporter=html npm test"},"repository":{"type":"git","url":"git+https://github.com/happner/happn-logger.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/happner/happn-logger/issues"},"homepage":"https://github.com/happner/happn-logger#readme","devDependencies":{"capture-stdout":"^1.0.0","happn-commons-test":"1.1.2"},"dependencies":{"log4js":"^6.3.0"},"gitHead":"39c9cb4d139c6b85245e6fa2a799d5175ed63fa8","_id":"happn-logger@2.2.2","_nodeVersion":"16.13.1","_npmVersion":"8.5.4","dist":{"integrity":"sha512-Rh3JEl1g1a6CY+ednEFp4iz7lu3VpesLKKFpE3bBIwvAUk19JaL3XpuGsIxaO7OCjEPKShtZ9C0a61gz2IGF4g==","shasum":"176d2b991a35d347e8364d5297360f8af0b3b52e","tarball":"https://registry.npmjs.org/happn-logger/-/happn-logger-2.2.2.tgz","fileCount":6,"unpackedSize":23254,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGT4bmZllofYKaXqFwadfaZkGVoEz5ySK81CrLwLyabaAiACu8vIbf4Wsr71SyApDqf63jUtfrFUYZJr98l8j8C2zg=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjgfJZACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo3ZRAAg/AnGH/1I1JnOB2gF3K1FCbFVqSCY1m78jkzaAt9H55Mspj0\r\nCubQrLAyTe8Z2OJDetubdPRdJsPrAt3kyo2g8xBDlAPAnbWiVF+y4dhg7yYK\r\nyAkqhzO6P37w056kLqZcjyEiCzHqKC6LagqmojItEOJ34DSzNLxEgzSUJDeu\r\nIMPxvMbJE2kKxCXgQGUUmOks15EPMKc1nCB1qkTeNWdXRGzD+L06VHv/zYz0\r\nfTypGt26bfGb2gIeZG9G60E7TMKqeaBcRn7UlgAuaBqRcApsK/ElMUzbRYTl\r\n8AqavIDPBnHipTYoGqM6jWSWQZGae0/lU9D7YE8XloHoA0JS9j/GLTAdqbsl\r\nmpWCMyY+dL+Udx5U48YN2vbntrRsszx0gCGGEfI/+EJMF8BUDy4WUi6a8Xp6\r\nHzMmVL5v2aWX/mAgqzm5wBlSKHtQ4mSiD1yKjsVOe2JfKa95eaS3EckG/NmT\r\nqKbi3QqbILzJWEb5xoWf4acqGa8r+8Mm9dsOtlcKPvHeAzrb5/we3oMwI6WV\r\n0eEmbAiORvsvAQHb6PeocRvEn1e9p+XZ5nyIGMXBAt8P1NYAQQIoCnHQYtyb\r\nx7wW3hWWTSPne/Jkap1IZp463bP8qnoZZ2sx/5vQeMpUkpzC/TEcDxJv3WNe\r\nNOH6D7X3x8Cdhe/14KDrw+pdFz0WZzPFK84=\r\n=ro23\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"simonbishopza","email":"simon.bishop.za@gmail.com"},"directories":{},"maintainers":[{"name":"nomilous","email":"nomilous@gmail.com"},{"name":"smc-tenacious","email":"eggers.jens@gmail.com"},{"name":"simonbishopza","email":"simon.bishop.za@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/happn-logger_2.2.2_1669460568876_0.6917086812923143"},"_hasShrinkwrap":false},"2.2.3-prerelease-1":{"name":"happn-logger","version":"2.2.3-prerelease-1","description":"Logger using log4js","main":"index.js","scripts":{"test":"_mocha --recursive --exit silence.js test/*","test-cover":"nyc --reporter=lcov --reporter=text-summary --reporter=html npm test"},"repository":{"type":"git","url":"git+https://github.com/happner/happn-logger.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/happner/happn-logger/issues"},"homepage":"https://github.com/happner/happn-logger#readme","devDependencies":{"capture-stdout":"^1.0.0","happn-commons-test":"1.2.0-prerelease-1"},"dependencies":{"log4js":"^6.3.0"},"readme":"[![Build Status](https://travis-ci.org/happner/happn-logger.svg?branch=master)](https://travis-ci.org/happner/happn-logger)\n\n# happn-logger\n\n`npm install happn-logger --save`\n\nLogger using log4js.\n\nOne instance of the logger is shared processwide. (global)\n\n## Usage\n\nWith context and component.\n\n```javascript\nvar Logger = require('happn-logger');\nvar context = Logger.createContext('ContextName');\nvar log = context.createLogger('ComponentName');\n\nlog.info('message');\n// [ INFO] - 1ms    ContextName (ComponentName) message\n\n// log can create a new component logger in the same context\nvar log2 = log.createLogger('AnotherComponent');\n\n```\n\nWith component only.\n\n```javascript\nvar Logger = require('happn-logger');\nvar log = Logger.createLogger('ComponentName');\n\nlog.info('message');\n// [ INFO] - 1ms    (ComponentName) message\n```\n\nCreating log functions on existing object.\n\n```javascript\nvar Logger = require('happn-logger');\n\nvar thing = new Thing();\nLogger.createLogger('thing', thing);\n\nthing.info('message');\n// [ INFO] - 1ms    (thing) message\n```\n\n### Context\n\nThe context of the logger can be modified. The change is applied to all loggers in that context.\n\n```javascript\nvar Logger = require('happn-logger');\nvar logContext = Logger.createContext('ContextName');\nvar log1 = logContext.createLogger('ComponentName1');\nvar log2 = logContext.createLogger('ComponentName2');\n\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    ContextName (ComponentName1) message\n// [ INFO] - 0ms    ContextName (ComponentName2) message\n\nlogContext.context = 'Renamed';\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    Renamed (ComponentName1) message\n// [ INFO] - 0ms    Renamed (ComponentName2) message\n```\n\nThe context can be renamed from any one of the loggers and it will apply to all in the context.\n\n```javascript\nlog1.context('RenamedAgain');\n\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    RenamedAgain (ComponentName1) message\n// [ INFO] - 0ms    RenamedAgain (ComponentName2) message\n```\n\n### Format string\n\nWhen logging it is best not to pre-assemble the string to be logged because the cost of doing so is incurred even when the level being logged-to is not enabled.\n\neg. `log.debug('number: ' + theNumber);`\n\nInstead, use a format string in the first argument. The logger will perform the string assembly internally __only if the log level is enabled__.\n\neg. `log.debug('number: %d, string: %s, json: %j', theNumber, theString, theObject);`\n\n### Levels\n\n```javascript\nlog.fatal('message');\nlog.error('message');\nlog.warn('message');\nlog.info('message');\nlog.debug('message');\nlog.trace('message');\n\nlog.log('message'); // goes to debug\n```\n\nDebug and trace messages can also be logged as follows\n\n```javascript\nlog.$$DEBUG('message');\nlog.$$TRACE('message');\n```\n\nThis allows for confident matchability to enable substituting all debug and trace calls out of production deployments. \n\n### Configuration\n\n__It is important. The configure() must be called at least once.__\n\nShown with default values below.\n\n```javascript\nvar Logger = require('happn-logger');\n\nLogger.configure({\n  logCacheSize: 50,\n  logLevel: 'info',\n  logTimeDelta: true,\n  logStackTraces: true,\n  logComponents: [],\n  logMessageDelimiter: '\\t',\n  logDateFormat: null,\n  logLayout: null,\n  logFile: null,\n  logFileMaxSize: 20480,\n  logFileBackups: 10,\n  logFileNameAbsolute: true,\n  logger: null\n});\n```\n\n#### logCacheSize\n\nAn array of recent log event messages is kept in `Logger.cache`. This specifies the size of that array.\n\nEnvironment variable __LOG_CACHE_SIZE__ overrides.\n\neg. `LOG_CACHE_SIZE=5000 node myServer.js`\n\n#### logLevel\n\noff, fatal, error, warn, info, debug, trace, all\n\nEnvironment variable __LOG_LEVEL__ overrides.\n\neg. `LOG_LEVEL=off node myServer.js`\n\n#### logTimeDelta\n\nLog the number of milliseconds since the previous log message.\n\n#### logStackTraces\n\nIf the last argument to the logger is an error, log the stack trace in a second message.\n\n#### logComponents\n\nAn array of log component names. Filters out all info, debug and trace messages from all component not in the list.\n\nEnvironment variable __LOG_COMPONENTS__ overrides.\n\neg. `LOG_COMPONENTS=component1,component2 node myServer.js`\n\n#### logMessageDelimiter\n\nThe delimiter appears between the timeDelta and the message.\n\n#### logDateFormat\n\nBy default no date appears in the log to console. However, dates are looged when the console is redirected (piped) to file. By specifying this format dates also be written to console.\n\neg. `'yyyy-MM-dd hh:mm:ss.SSS'`\n\n#### logLayout\n\nThis allows for specifying of the full log line layout. \n\neg.\n```javascript\n  ...\n  logLayout: {\n    type: 'pattern',\n    pattern: '%d{yyyy-MM-dd hh:mm:ss.SSS} [%[%5.5p%]] - %m'\n  },\n  ...\n```\n\n#### logFile\n\nIf specified - the logger logs to file and console. \n\n__Note: Using the file logger will in most cases fail to capture a logged fatal event that brought your server down. The file write is asynchronous and the exiting process does not wait. The log from console redirected to file will include the error because console writes are synchronous.__\n\n#### logFileMaxSize, logFileBackups\n\nLimit disk resources used by log file. This specifies how big the log file is allowed to get before 'archiving' it, and how many archive backups should be kept.\n\nIt creates `.log` (the current log), `.log.1` (the previous log), `.log.2` (older), etc\n\n#### logFileLayout\n\nSame as logLayout above - but for the logFile not the console.\n\n#### logFileNameAbsolute\n\nSpecifies if the specified logFile is an \"absolute\" filename. Don't know why it matters. It's a log4js parameter.\n\n#### logger\n\nEnables passing in a full log4js config. All log4js config fragments from the preceding list are ignored in favour of this full config.\n\neg.\n```javascript\n  ...\n  logger: {\n    appenders: [\n      {\n        type: \"console\",\n        layout: {\n          type: 'pattern',\n          pattern: '%d{yyyy-MM-dd hh:mm:ss.SSS} [%[%5.5p%]] - %m'\n        }\n      }\n    ]\n  },\n  ...\n```\n\n\n### Events\n\nThe logger emits an event before and after each log message. This enables console applications, terminals and similar to prepare for and/or recover from the logger performing a console write.\n\neg.\n```javascript\n\nLogger.emitter.on('before', function() {\n  // Runs immediately before every log write.\n});\n\nLogger.emitter.on('after', function() {\n  // Runs immediately after every log write.\n});\n\n//you can also listen for the actual log message and level\nLogger.emitter.on('after', function(level, message) {\n\n  //level = info|error|warn|debug\n  //message = 1ms<tab>hello\n\n});\n\n```\n\n","readmeFilename":"README.md","gitHead":"33eebbd4ab176e3e654c6193914665d6840ddd0e","_id":"happn-logger@2.2.3-prerelease-1","_nodeVersion":"16.13.1","_npmVersion":"8.5.4","dist":{"integrity":"sha512-kf82JuMrqKvTn0Y3qe9veZnct5XDZVfkoCVcYa2hSk8/zfmok/e0DYeEPNeN/gsVcVZw/mOOyGX9BmchLl6OZg==","shasum":"ee6632faec0e656aab3d2a3f375720b868b9f64b","tarball":"https://registry.npmjs.org/happn-logger/-/happn-logger-2.2.3-prerelease-1.tgz","fileCount":6,"unpackedSize":23354,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDCTbLLqXBwn5pqzrBaUPGD8J/MRb/Aok+eVQE+4GgEgAiEAnVgqFXuSGlN/r6JiRFbmlMR5xkHn12N/u5cBn1zM4+o="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvu6GACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo42Q/+Oh38lYyrWE4xNoPYvzTUq6ETmXSGWT6GUjLCzDgk2WPk5Js0\r\nxq1WYzuoFyvTweG+o91p7YsLZYqgJRSe7ChmBWycYJoMwKAXbu6Bp0pmrHFu\r\ngNUNIdXPZpOuULPzIuh/1DDtdN37jbqu5bLjAb1J13SekQA3FbJi/SegSn+u\r\nHcSIYofK42hHmbH7WwP6ItF/sfMfVq6b1i45NjpbTzqID6g7fe6QH9iJR5Fg\r\nc1ApvLBTQtfaGZoQD/wOijurqqW3P3p22BTJSnu2D78m8L6Fer5wZStxtxeg\r\nnxlOJCwITGTnWT4O2vfVdthvmQqWJmFiu7CegedNmZLLsaLSp53sKIOPsKkl\r\n+6XLq0ulRpomA3PJDdzEWhHkYxHTvDuMJqrNNmDngnzZKNNW5viVXTsJqEou\r\n8Vmm/ptMyITeiK9Al6vVXMeIM9Clmolao+lYrtNq5NOGXVzuDrXO1PTgUQ8X\r\n7ueimyO3/yxZYN8J4KI7Fc/jFr66IjnrA8IgbHN6IqJwJnZwvsTRZ+P4jb7p\r\nmSF8n0KqsBn3KrNhNSRKRrITQVIdssvCX+ZI9Nx8VxXit6iJWjm0G63poxGT\r\nXQkXfPd5Wx2WND74YZI4fuPTq5z2F5bnIFFUJZkYZJZG5HileCVkMm8p1MSP\r\n4+CLPP4sxwQI6C8bbpv61zC1VlepYFcS/x8=\r\n=AZIi\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"simonbishopza","email":"simon.bishop.za@gmail.com"},"directories":{},"maintainers":[{"name":"nomilous","email":"nomilous@gmail.com"},{"name":"smc-tenacious","email":"eggers.jens@gmail.com"},{"name":"simonbishopza","email":"simon.bishop.za@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/happn-logger_2.2.3-prerelease-1_1673457286370_0.3897393125009052"},"_hasShrinkwrap":false},"2.2.3":{"name":"happn-logger","version":"2.2.3","description":"Logger using log4js","main":"index.js","scripts":{"test":"_mocha --recursive --exit silence.js test/*","test-cover":"nyc --reporter=lcov --reporter=text-summary --reporter=html npm test"},"repository":{"type":"git","url":"git+https://github.com/happner/happn-logger.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/happner/happn-logger/issues"},"homepage":"https://github.com/happner/happn-logger#readme","devDependencies":{"capture-stdout":"^1.0.0","happn-commons-test":"1.2.0"},"dependencies":{"log4js":"^6.3.0"},"gitHead":"d3319a3a74d1139c8d9d82123d22d2137512170f","_id":"happn-logger@2.2.3","_nodeVersion":"16.13.1","_npmVersion":"8.5.4","dist":{"integrity":"sha512-JGQ3VxDchoFpFeb5QjkmxyH/OnQB/BpKqavhfZSBBbry+vJcK7Ctd1mk5SPk+Ml37IEBho0If2DmvfBJB44ZAw==","shasum":"beb0816303c9796f8bc8f618c1dbab89181997a0","tarball":"https://registry.npmjs.org/happn-logger/-/happn-logger-2.2.3.tgz","fileCount":6,"unpackedSize":23328,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCKS5fZbuJRY0VimytBtq2gp8lpUQDxiMYxyrWd49W7fQIgHYCZBy5l/Y/jQnuIa0h0JH49W1kVDvhUUVNaeDPzGzQ="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjx9ELACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmomWA/9HHe1rrWsKfEMZREEH+EGY0pX4rbGhqIFoTmZpzWStH6GrruY\r\nYbNNER7FRWzFLerLsPfNQZqyLtF2F6PwbadtEbvARi5BuzYO6HZyZ+5gojo5\r\nda5sdyfYgKvGVFBGrgqN5bq5GTbBnR3g1b2Ex01pR6DPtJ0q7x0NjLX9MjBF\r\nJWw505AXqkKOat2Pe+UAcVdt7aj/A4c73Htn4tPhYKbEPr4yD8GKFfWitV55\r\nl/r6JB9OuWV78CxmAZlX8rX6p0h1jCIMy/tq9scxUcHoX+piyfSPHxXhLZIW\r\nkmjD2yh0oJ9CvR0HqQHM4MsXISf7NtuKB3cISjJLWXStdeA3xRkEyp21kxfo\r\nt8AfPrtZ77pR68AZa2EajMAOGkxLZpJ0Of7R96kxWQLxRLGCtXgNeNLDznIu\r\nJCWrgKK5mN9C79IencYHB+slBTpim56CJ9VVi2LMm8HOnTEiqRgfTtn9wkYB\r\n353NXbHBGuPByWucfvb9UNFgWOiUX1BQePPw5jpCJcKHeNJQTf4fdw7Kc5DM\r\nTFyYPSlia/+yaaiiURBEncUKWq2ApmqRLN6P6Xuk4lGbtfcGN/2RPO5OqhHs\r\nd6NuiQPrGfpd+a3fqdGL4zE1jdKgPMVsyGgOGWvekmfPUiuOa4Jraoe2Urmu\r\nU7OrEXyRPV7mMWYdbsgrhNJc89V60C2c4cY=\r\n=Qocj\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"simonbishopza","email":"simon.bishop.za@gmail.com"},"directories":{},"maintainers":[{"name":"nomilous","email":"nomilous@gmail.com"},{"name":"smc-tenacious","email":"eggers.jens@gmail.com"},{"name":"simonbishopza","email":"simon.bishop.za@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/happn-logger_2.2.3_1674039562785_0.28119232489398716"},"_hasShrinkwrap":false},"2.2.4-prerelease-1":{"name":"happn-logger","version":"2.2.4-prerelease-1","description":"Logger using log4js","main":"index.js","scripts":{"test":"_mocha --recursive --exit silence.js test/*","test-cover":"nyc --reporter=lcov --reporter=text-summary --reporter=html npm test"},"repository":{"type":"git","url":"git+https://github.com/happner/happn-logger.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/happner/happn-logger/issues"},"homepage":"https://github.com/happner/happn-logger#readme","devDependencies":{"capture-stdout":"^1.0.0","happn-commons-test":"1.2.1-prerelease-1"},"dependencies":{"log4js":"^6.3.0"},"readme":"[![Build Status](https://travis-ci.org/happner/happn-logger.svg?branch=master)](https://travis-ci.org/happner/happn-logger)\n\n# happn-logger\n\n`npm install happn-logger --save`\n\nLogger using log4js.\n\nOne instance of the logger is shared processwide. (global)\n\n## Usage\n\nWith context and component.\n\n```javascript\nvar Logger = require('happn-logger');\nvar context = Logger.createContext('ContextName');\nvar log = context.createLogger('ComponentName');\n\nlog.info('message');\n// [ INFO] - 1ms    ContextName (ComponentName) message\n\n// log can create a new component logger in the same context\nvar log2 = log.createLogger('AnotherComponent');\n\n```\n\nWith component only.\n\n```javascript\nvar Logger = require('happn-logger');\nvar log = Logger.createLogger('ComponentName');\n\nlog.info('message');\n// [ INFO] - 1ms    (ComponentName) message\n```\n\nCreating log functions on existing object.\n\n```javascript\nvar Logger = require('happn-logger');\n\nvar thing = new Thing();\nLogger.createLogger('thing', thing);\n\nthing.info('message');\n// [ INFO] - 1ms    (thing) message\n```\n\n### Context\n\nThe context of the logger can be modified. The change is applied to all loggers in that context.\n\n```javascript\nvar Logger = require('happn-logger');\nvar logContext = Logger.createContext('ContextName');\nvar log1 = logContext.createLogger('ComponentName1');\nvar log2 = logContext.createLogger('ComponentName2');\n\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    ContextName (ComponentName1) message\n// [ INFO] - 0ms    ContextName (ComponentName2) message\n\nlogContext.context = 'Renamed';\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    Renamed (ComponentName1) message\n// [ INFO] - 0ms    Renamed (ComponentName2) message\n```\n\nThe context can be renamed from any one of the loggers and it will apply to all in the context.\n\n```javascript\nlog1.context('RenamedAgain');\n\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    RenamedAgain (ComponentName1) message\n// [ INFO] - 0ms    RenamedAgain (ComponentName2) message\n```\n\n### Format string\n\nWhen logging it is best not to pre-assemble the string to be logged because the cost of doing so is incurred even when the level being logged-to is not enabled.\n\neg. `log.debug('number: ' + theNumber);`\n\nInstead, use a format string in the first argument. The logger will perform the string assembly internally __only if the log level is enabled__.\n\neg. `log.debug('number: %d, string: %s, json: %j', theNumber, theString, theObject);`\n\n### Levels\n\n```javascript\nlog.fatal('message');\nlog.error('message');\nlog.warn('message');\nlog.info('message');\nlog.debug('message');\nlog.trace('message');\n\nlog.log('message'); // goes to debug\n```\n\nDebug and trace messages can also be logged as follows\n\n```javascript\nlog.$$DEBUG('message');\nlog.$$TRACE('message');\n```\n\nThis allows for confident matchability to enable substituting all debug and trace calls out of production deployments. \n\n### Configuration\n\n__It is important. The configure() must be called at least once.__\n\nShown with default values below.\n\n```javascript\nvar Logger = require('happn-logger');\n\nLogger.configure({\n  logCacheSize: 50,\n  logLevel: 'info',\n  logTimeDelta: true,\n  logStackTraces: true,\n  logComponents: [],\n  logMessageDelimiter: '\\t',\n  logDateFormat: null,\n  logLayout: null,\n  logFile: null,\n  logFileMaxSize: 20480,\n  logFileBackups: 10,\n  logFileNameAbsolute: true,\n  logger: null\n});\n```\n\n#### logCacheSize\n\nAn array of recent log event messages is kept in `Logger.cache`. This specifies the size of that array.\n\nEnvironment variable __LOG_CACHE_SIZE__ overrides.\n\neg. `LOG_CACHE_SIZE=5000 node myServer.js`\n\n#### logLevel\n\noff, fatal, error, warn, info, debug, trace, all\n\nEnvironment variable __LOG_LEVEL__ overrides.\n\neg. `LOG_LEVEL=off node myServer.js`\n\n#### logTimeDelta\n\nLog the number of milliseconds since the previous log message.\n\n#### logStackTraces\n\nIf the last argument to the logger is an error, log the stack trace in a second message.\n\n#### logComponents\n\nAn array of log component names. Filters out all info, debug and trace messages from all component not in the list.\n\nEnvironment variable __LOG_COMPONENTS__ overrides.\n\neg. `LOG_COMPONENTS=component1,component2 node myServer.js`\n\n#### logMessageDelimiter\n\nThe delimiter appears between the timeDelta and the message.\n\n#### logDateFormat\n\nBy default no date appears in the log to console. However, dates are looged when the console is redirected (piped) to file. By specifying this format dates also be written to console.\n\neg. `'yyyy-MM-dd hh:mm:ss.SSS'`\n\n#### logLayout\n\nThis allows for specifying of the full log line layout. \n\neg.\n```javascript\n  ...\n  logLayout: {\n    type: 'pattern',\n    pattern: '%d{yyyy-MM-dd hh:mm:ss.SSS} [%[%5.5p%]] - %m'\n  },\n  ...\n```\n\n#### logFile\n\nIf specified - the logger logs to file and console. \n\n__Note: Using the file logger will in most cases fail to capture a logged fatal event that brought your server down. The file write is asynchronous and the exiting process does not wait. The log from console redirected to file will include the error because console writes are synchronous.__\n\n#### logFileMaxSize, logFileBackups\n\nLimit disk resources used by log file. This specifies how big the log file is allowed to get before 'archiving' it, and how many archive backups should be kept.\n\nIt creates `.log` (the current log), `.log.1` (the previous log), `.log.2` (older), etc\n\n#### logFileLayout\n\nSame as logLayout above - but for the logFile not the console.\n\n#### logFileNameAbsolute\n\nSpecifies if the specified logFile is an \"absolute\" filename. Don't know why it matters. It's a log4js parameter.\n\n#### logger\n\nEnables passing in a full log4js config. All log4js config fragments from the preceding list are ignored in favour of this full config.\n\neg.\n```javascript\n  ...\n  logger: {\n    appenders: [\n      {\n        type: \"console\",\n        layout: {\n          type: 'pattern',\n          pattern: '%d{yyyy-MM-dd hh:mm:ss.SSS} [%[%5.5p%]] - %m'\n        }\n      }\n    ]\n  },\n  ...\n```\n\n\n### Events\n\nThe logger emits an event before and after each log message. This enables console applications, terminals and similar to prepare for and/or recover from the logger performing a console write.\n\neg.\n```javascript\n\nLogger.emitter.on('before', function() {\n  // Runs immediately before every log write.\n});\n\nLogger.emitter.on('after', function() {\n  // Runs immediately after every log write.\n});\n\n//you can also listen for the actual log message and level\nLogger.emitter.on('after', function(level, message) {\n\n  //level = info|error|warn|debug\n  //message = 1ms<tab>hello\n\n});\n\n```\n\n","readmeFilename":"README.md","gitHead":"70d6413fce09630e45f6d723baa9dc4b3cf792c3","_id":"happn-logger@2.2.4-prerelease-1","_nodeVersion":"16.13.1","_npmVersion":"8.5.4","dist":{"integrity":"sha512-ABuRalFLRcn9Kt/b6V2eDGs0tklQeD5nInsmpRbDJ+i7R36fW5Yx1MKxj9qkWzZoN4mQ7l2cDF4VKClna+exNA==","shasum":"2395df108158bf843087a9232c944e96cb4d89da","tarball":"https://registry.npmjs.org/happn-logger/-/happn-logger-2.2.4-prerelease-1.tgz","fileCount":6,"unpackedSize":23415,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC0gin7TX5ZsJ/CiJtNqUPp7EYj0M9VxT1qQbyMoVIltAIgaxZDzUcxQMVLLVyB0AV+bNHBEh3RoGyWIxCCzHcC3P0="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjx/q0ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrghg/9Hnn2akfzIw9KZa2rOfUwIeQnuNea4bH4aSt+P5rU+/oB6MYS\r\nBNZualT2QbpUXC3KlG0LA8iI2jN9uXZYcqnfamtjQzjFSamryJNk8BQ3FPm/\r\nU8fyeAhzY72bi3o8/zhSVFsuinW/bOyMjpW3IgTrNNO2+VwtDxtxHeWVqCvM\r\nC7NrEoS0hag4WrcglTBMlwCftRjcKJSdQECgq98H8eIcEIB/oWb14h3ewhXH\r\nnbnLHjvDeniey4SNOHYFmPhaL6wEeEW3TnlDQVr2xkg6YmmujLdSO85ZNSLQ\r\njz2GmuxbJyS4Hn6qKz/gh2IQjTLQVNpBLM9kLq/GsaTdT2eBSpv4KooRIh+N\r\npcBWlcM4qWLyDECLV1hMbW2+kED6DHKEl+jFGqzCHantuFtvTuXVijjHhEIV\r\n+nnl3g2GOA/SyeIIaZw77FlT8gRWB8lnHBJbwaICl+sR4fNySkxvOdOwP2l9\r\nuJEmycw6QU45o6vdiRtrAOwIt3sNIb198jtHhMGYzlyadbJ186UfOefA3hSz\r\nOOssGeNvStKbiWcrKowcZ+sRtls708VYGILZXHQ6U3QlmIorTmzO3uG+hNu0\r\nsLQ3vh7+h8Rl8jm+WsL5HdZ3vYDuD2s3LyxBuHgXpt1XjTqy7Sfe6YAbNpBr\r\n3iuXYzOvYHVUrOa5Oe0SqOEZGwTByDOqcC4=\r\n=et13\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"simonbishopza","email":"simon.bishop.za@gmail.com"},"directories":{},"maintainers":[{"name":"nomilous","email":"nomilous@gmail.com"},{"name":"smc-tenacious","email":"eggers.jens@gmail.com"},{"name":"simonbishopza","email":"simon.bishop.za@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/happn-logger_2.2.4-prerelease-1_1674050228169_0.1619098949189599"},"_hasShrinkwrap":false},"2.2.4-prerelease-2":{"name":"happn-logger","version":"2.2.4-prerelease-2","description":"Logger using log4js","main":"index.js","scripts":{"test":"_mocha --recursive --exit silence.js test/*","test-cover":"nyc --reporter=lcov --reporter=text-summary --reporter=html npm test"},"repository":{"type":"git","url":"git+https://github.com/happner/happn-logger.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/happner/happn-logger/issues"},"homepage":"https://github.com/happner/happn-logger#readme","devDependencies":{"capture-stdout":"^1.0.0","happn-commons-test":"1.2.1-prerelease-2"},"dependencies":{"log4js":"^6.3.0"},"readme":"[![Build Status](https://travis-ci.org/happner/happn-logger.svg?branch=master)](https://travis-ci.org/happner/happn-logger)\n\n# happn-logger\n\n`npm install happn-logger --save`\n\nLogger using log4js.\n\nOne instance of the logger is shared processwide. (global)\n\n## Usage\n\nWith context and component.\n\n```javascript\nvar Logger = require('happn-logger');\nvar context = Logger.createContext('ContextName');\nvar log = context.createLogger('ComponentName');\n\nlog.info('message');\n// [ INFO] - 1ms    ContextName (ComponentName) message\n\n// log can create a new component logger in the same context\nvar log2 = log.createLogger('AnotherComponent');\n\n```\n\nWith component only.\n\n```javascript\nvar Logger = require('happn-logger');\nvar log = Logger.createLogger('ComponentName');\n\nlog.info('message');\n// [ INFO] - 1ms    (ComponentName) message\n```\n\nCreating log functions on existing object.\n\n```javascript\nvar Logger = require('happn-logger');\n\nvar thing = new Thing();\nLogger.createLogger('thing', thing);\n\nthing.info('message');\n// [ INFO] - 1ms    (thing) message\n```\n\n### Context\n\nThe context of the logger can be modified. The change is applied to all loggers in that context.\n\n```javascript\nvar Logger = require('happn-logger');\nvar logContext = Logger.createContext('ContextName');\nvar log1 = logContext.createLogger('ComponentName1');\nvar log2 = logContext.createLogger('ComponentName2');\n\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    ContextName (ComponentName1) message\n// [ INFO] - 0ms    ContextName (ComponentName2) message\n\nlogContext.context = 'Renamed';\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    Renamed (ComponentName1) message\n// [ INFO] - 0ms    Renamed (ComponentName2) message\n```\n\nThe context can be renamed from any one of the loggers and it will apply to all in the context.\n\n```javascript\nlog1.context('RenamedAgain');\n\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    RenamedAgain (ComponentName1) message\n// [ INFO] - 0ms    RenamedAgain (ComponentName2) message\n```\n\n### Format string\n\nWhen logging it is best not to pre-assemble the string to be logged because the cost of doing so is incurred even when the level being logged-to is not enabled.\n\neg. `log.debug('number: ' + theNumber);`\n\nInstead, use a format string in the first argument. The logger will perform the string assembly internally __only if the log level is enabled__.\n\neg. `log.debug('number: %d, string: %s, json: %j', theNumber, theString, theObject);`\n\n### Levels\n\n```javascript\nlog.fatal('message');\nlog.error('message');\nlog.warn('message');\nlog.info('message');\nlog.debug('message');\nlog.trace('message');\n\nlog.log('message'); // goes to debug\n```\n\nDebug and trace messages can also be logged as follows\n\n```javascript\nlog.$$DEBUG('message');\nlog.$$TRACE('message');\n```\n\nThis allows for confident matchability to enable substituting all debug and trace calls out of production deployments. \n\n### Configuration\n\n__It is important. The configure() must be called at least once.__\n\nShown with default values below.\n\n```javascript\nvar Logger = require('happn-logger');\n\nLogger.configure({\n  logCacheSize: 50,\n  logLevel: 'info',\n  logTimeDelta: true,\n  logStackTraces: true,\n  logComponents: [],\n  logMessageDelimiter: '\\t',\n  logDateFormat: null,\n  logLayout: null,\n  logFile: null,\n  logFileMaxSize: 20480,\n  logFileBackups: 10,\n  logFileNameAbsolute: true,\n  logger: null\n});\n```\n\n#### logCacheSize\n\nAn array of recent log event messages is kept in `Logger.cache`. This specifies the size of that array.\n\nEnvironment variable __LOG_CACHE_SIZE__ overrides.\n\neg. `LOG_CACHE_SIZE=5000 node myServer.js`\n\n#### logLevel\n\noff, fatal, error, warn, info, debug, trace, all\n\nEnvironment variable __LOG_LEVEL__ overrides.\n\neg. `LOG_LEVEL=off node myServer.js`\n\n#### logTimeDelta\n\nLog the number of milliseconds since the previous log message.\n\n#### logStackTraces\n\nIf the last argument to the logger is an error, log the stack trace in a second message.\n\n#### logComponents\n\nAn array of log component names. Filters out all info, debug and trace messages from all component not in the list.\n\nEnvironment variable __LOG_COMPONENTS__ overrides.\n\neg. `LOG_COMPONENTS=component1,component2 node myServer.js`\n\n#### logMessageDelimiter\n\nThe delimiter appears between the timeDelta and the message.\n\n#### logDateFormat\n\nBy default no date appears in the log to console. However, dates are looged when the console is redirected (piped) to file. By specifying this format dates also be written to console.\n\neg. `'yyyy-MM-dd hh:mm:ss.SSS'`\n\n#### logLayout\n\nThis allows for specifying of the full log line layout. \n\neg.\n```javascript\n  ...\n  logLayout: {\n    type: 'pattern',\n    pattern: '%d{yyyy-MM-dd hh:mm:ss.SSS} [%[%5.5p%]] - %m'\n  },\n  ...\n```\n\n#### logFile\n\nIf specified - the logger logs to file and console. \n\n__Note: Using the file logger will in most cases fail to capture a logged fatal event that brought your server down. The file write is asynchronous and the exiting process does not wait. The log from console redirected to file will include the error because console writes are synchronous.__\n\n#### logFileMaxSize, logFileBackups\n\nLimit disk resources used by log file. This specifies how big the log file is allowed to get before 'archiving' it, and how many archive backups should be kept.\n\nIt creates `.log` (the current log), `.log.1` (the previous log), `.log.2` (older), etc\n\n#### logFileLayout\n\nSame as logLayout above - but for the logFile not the console.\n\n#### logFileNameAbsolute\n\nSpecifies if the specified logFile is an \"absolute\" filename. Don't know why it matters. It's a log4js parameter.\n\n#### logger\n\nEnables passing in a full log4js config. All log4js config fragments from the preceding list are ignored in favour of this full config.\n\neg.\n```javascript\n  ...\n  logger: {\n    appenders: [\n      {\n        type: \"console\",\n        layout: {\n          type: 'pattern',\n          pattern: '%d{yyyy-MM-dd hh:mm:ss.SSS} [%[%5.5p%]] - %m'\n        }\n      }\n    ]\n  },\n  ...\n```\n\n\n### Events\n\nThe logger emits an event before and after each log message. This enables console applications, terminals and similar to prepare for and/or recover from the logger performing a console write.\n\neg.\n```javascript\n\nLogger.emitter.on('before', function() {\n  // Runs immediately before every log write.\n});\n\nLogger.emitter.on('after', function() {\n  // Runs immediately after every log write.\n});\n\n//you can also listen for the actual log message and level\nLogger.emitter.on('after', function(level, message) {\n\n  //level = info|error|warn|debug\n  //message = 1ms<tab>hello\n\n});\n\n```\n\n","readmeFilename":"README.md","gitHead":"3376f07492663de04b0ff6eb77767a59315ff731","_id":"happn-logger@2.2.4-prerelease-2","_nodeVersion":"16.13.1","_npmVersion":"8.5.4","dist":{"integrity":"sha512-8pTVdBO5gytIvf6jIH4e5Z7NP3IAb+XIqoF1t4EmB0KJ4hqqhg2r9U505EI5TtbHphNxSt1x+P0qo95HsOvirw==","shasum":"41d1a1a094ab03c575d3e95268f9d0f524988d01","tarball":"https://registry.npmjs.org/happn-logger/-/happn-logger-2.2.4-prerelease-2.tgz","fileCount":6,"unpackedSize":23415,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDCMkmlc4vo8m7hemFzlSYUk0XMMqAxMyDvWH8gfkybOwIgHwt6u17srWFNUAVISa+RjNX/kcITezG6vsrWAcgJbKY="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj0lh5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmonsRAAjDhn/gG5RxBN1uQOB0efg52Y3aW8/PdFWAvx3wIDO81yv7uW\r\nfh+2ZyqKnVpT/BiAjLtTqOt6ABlMB+4aWJYLgVz8t78FIQ2dipsOAgkhySKt\r\nloHCGPjpv++qFRxR13y8EAyAsRvOGa3AZ+o/i0eveuq/1YSUkMpDK/Kl6Ed2\r\nyV6JiuieexDr+R9towbNsylxxaI2r+VRsgQRUyQdKWfFNq6d2j5hPbqBVuOh\r\n9k8gaO8AiWicz0ADYlWf1Wv371PZz2GnEVpbwoNF2cvqOXfebHQfiPIqOObr\r\nDIMAwrGHNhiIOtjpgTyoFcPM8eY4edEkGuejfjWmGXN5QFzDE3zQapL/M9Se\r\nxVKw6jluqntWxymGb57wgRogImVFGDuOGMgazsGAcdzrOQFssWzUK096+V/Y\r\n2n5xk6GSEj21LUrG5IBua2VOmlJGi5JeZhedyCZdj0cZ5Or3fxgwbzw5SPtg\r\nlj5gL35o9Wshl3EnXcKh2tzSqyQonkyFK5GO2NcnBHr5LT9ck8i5xVTH7R89\r\nd8/sFyOpKwxdBnutoQjLw5nO1J1YpgQe9+WUFbsAJx3OTUpsskTnqDqxYORr\r\npORwNQJU7zmgJMq02mLzBAH06KHPrt5FaqhKZhqVxdQQkVT/RkAxd3yli9iH\r\npQUuLoQyMm6TssNdnbzYHtzVaalkDE8iajI=\r\n=j2m2\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"simonbishopza","email":"simon.bishop.za@gmail.com"},"directories":{},"maintainers":[{"name":"nomilous","email":"nomilous@gmail.com"},{"name":"smc-tenacious","email":"eggers.jens@gmail.com"},{"name":"simonbishopza","email":"simon.bishop.za@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/happn-logger_2.2.4-prerelease-2_1674729593318_0.7763127625244435"},"_hasShrinkwrap":false},"2.2.4":{"name":"happn-logger","version":"2.2.4","description":"Logger using log4js","main":"index.js","scripts":{"test":"_mocha --recursive --exit silence.js test/*","test-cover":"nyc --reporter=lcov --reporter=text-summary --reporter=html npm test"},"repository":{"type":"git","url":"git+https://github.com/happner/happn-logger.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/happner/happn-logger/issues"},"homepage":"https://github.com/happner/happn-logger#readme","devDependencies":{"capture-stdout":"^1.0.0","happn-commons-test":"1.2.1"},"dependencies":{"log4js":"^6.3.0"},"gitHead":"bde6ce85069d10190abd6f72811a2d454b54177b","_id":"happn-logger@2.2.4","_nodeVersion":"16.13.1","_npmVersion":"8.5.4","dist":{"integrity":"sha512-AY8zhu2V3e8OhAPasaHiMb2rIrsCiHzDYg7apelSjBwRHZSC/OZfHZvIEaMRABxNOLGTwyaZtOZuoS23EAlchQ==","shasum":"6a20a16e7de59eaa95349a479fade0c7b1cd4128","tarball":"https://registry.npmjs.org/happn-logger/-/happn-logger-2.2.4.tgz","fileCount":6,"unpackedSize":23389,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD0XIetzWono1MlitsKol3nbGgN3wK6iryhNEYN/HHfggIgKx5xSPyf0txENT3ezxmkeRqut8W+BV2ZJKVPgc4xefo="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj4OnaACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrqlQ//Tbp1lwbTCWgCc2wyQmkVB1xIPhk/CgdjSYv9+03niycxqDL1\r\ntu2uSGUyEhl6U+KUWPIVPyI2lux9R6clVRTtRYi1Vvsu9V8qLLKO3VUDLHc/\r\nZz2n5AqGJn7qwRM2f9uafVQsSGuUgrAvLu4/iiarN05+CHMNYdVtBUmUZv5H\r\n6qy20YBWpJIlXYY+jZ780Gf0BTFPBqZGlJC6N9s9NqtgNEi/5OooUC/JOBtm\r\ncQmt3tsS1HslM/9ao0oMmLTNDXBnDTwELUJrKWHJpkGuXiE5nV+au64zk+7z\r\nDLoF4YDAFQ/bFsekD0DPVaceNzXXi+aovwpZLKN9c0CRZtoUb6qJVxyTR6pa\r\n6yTihpAUJox9Oq6rqZMnDZZfgm8WUVO5jJHgKhCBhhDKLLY9X2KLospkqtc/\r\nrlbmtTmiF3dCDGp2WQRYamPIvCz/9nPn7dTbCqEFkLaoWwoYUyBjJ1iXdVdY\r\njFK/M2Z5i5v6P9Uw4vGPK31kv/iuGF2+sEWuRoXXYmorfMWsODBbYAr7Z9Vb\r\ng4VduCwWXuj23wxGU7FtR7m9qPjgjPW4XHnDajgpQLLqOFfAvdPacotwpG7Z\r\nqLAMGOumREynjCs2a2PgClbwGCUQ/xMztSRnc1ctQeK3daMXVm4XrE5CJ8/o\r\nXfZOIlGorWlIK1pNhOQR6+Dm4/daZAlYTkA=\r\n=AYcj\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"simonbishopza","email":"simon.bishop.za@gmail.com"},"directories":{},"maintainers":[{"name":"nomilous","email":"nomilous@gmail.com"},{"name":"smc-tenacious","email":"eggers.jens@gmail.com"},{"name":"simonbishopza","email":"simon.bishop.za@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/happn-logger_2.2.4_1675684314166_0.3081928316402296"},"_hasShrinkwrap":false},"2.2.5":{"name":"happn-logger","version":"2.2.5","description":"Logger using log4js","main":"index.js","scripts":{"test":"_mocha --recursive --exit silence.js test/*","test-cover":"nyc --reporter=lcov --reporter=text-summary --reporter=html npm test"},"repository":{"type":"git","url":"git+https://github.com/happner/happn-logger.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/happner/happn-logger/issues"},"homepage":"https://github.com/happner/happn-logger#readme","devDependencies":{"capture-stdout":"^1.0.0","happn-commons-test":"1.2.2"},"dependencies":{"log4js":"^6.3.0"},"gitHead":"a0532d747423553659af1f503ff00fedfeced472","_id":"happn-logger@2.2.5","_nodeVersion":"16.13.1","_npmVersion":"8.5.4","dist":{"integrity":"sha512-3df1z93xNMSDkYEDwl3jW7jldCG24/KgryqCDvw/VDQPEQe9w27hxU0o04OM1FLnGpQjh30puBsy3TjBW6AfHA==","shasum":"5ab34337d100de32a654add7fd3fa1ac5de1a3ce","tarball":"https://registry.npmjs.org/happn-logger/-/happn-logger-2.2.5.tgz","fileCount":6,"unpackedSize":23467,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDQqhOAHonRqBJLbxoxKxKq9lbuzUw8dsMigX5mqRRumAIge3PPae0MEIkgS5H+MPfUxw6dxdEJNwHSHrtjts+9sPo="}]},"_npmUser":{"name":"simonbishopza","email":"simon.bishop.za@gmail.com"},"directories":{},"maintainers":[{"name":"nomilous","email":"nomilous@gmail.com"},{"name":"smc-tenacious","email":"eggers.jens@gmail.com"},{"name":"simonbishopza","email":"simon.bishop.za@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/happn-logger_2.2.5_1691322683767_0.7678892433827542"},"_hasShrinkwrap":false},"2.2.6-prerelease-1":{"name":"happn-logger","version":"2.2.6-prerelease-1","description":"Logger using log4js","main":"index.js","scripts":{"test":"_mocha --recursive --exit silence.js test/*","test-cover":"nyc --reporter=lcov --reporter=text-summary --reporter=html npm test"},"repository":{"type":"git","url":"git+https://github.com/happner/happn-logger.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/happner/happn-logger/issues"},"homepage":"https://github.com/happner/happn-logger#readme","devDependencies":{"capture-stdout":"^1.0.0","happn-commons-test":"1.2.3-prerelease-1"},"dependencies":{"log4js":"^6.3.0"},"gitHead":"1f882938bae73c0cbd943ef5add26539ad40c713","readme":"[![Build Status](https://travis-ci.org/happner/happn-logger.svg?branch=master)](https://travis-ci.org/happner/happn-logger)\n\n# happn-logger\n\n`npm install happn-logger --save`\n\nLogger using log4js.\n\nOne instance of the logger is shared processwide. (global)\n\n## Usage\n\nWith context and component.\n\n```javascript\nvar Logger = require('happn-logger');\nvar context = Logger.createContext('ContextName');\nvar log = context.createLogger('ComponentName');\n\nlog.info('message');\n// [ INFO] - 1ms    ContextName (ComponentName) message\n\n// log can create a new component logger in the same context\nvar log2 = log.createLogger('AnotherComponent');\n\n```\n\nWith component only.\n\n```javascript\nvar Logger = require('happn-logger');\nvar log = Logger.createLogger('ComponentName');\n\nlog.info('message');\n// [ INFO] - 1ms    (ComponentName) message\n```\n\nCreating log functions on existing object.\n\n```javascript\nvar Logger = require('happn-logger');\n\nvar thing = new Thing();\nLogger.createLogger('thing', thing);\n\nthing.info('message');\n// [ INFO] - 1ms    (thing) message\n```\n\n### Context\n\nThe context of the logger can be modified. The change is applied to all loggers in that context.\n\n```javascript\nvar Logger = require('happn-logger');\nvar logContext = Logger.createContext('ContextName');\nvar log1 = logContext.createLogger('ComponentName1');\nvar log2 = logContext.createLogger('ComponentName2');\n\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    ContextName (ComponentName1) message\n// [ INFO] - 0ms    ContextName (ComponentName2) message\n\nlogContext.context = 'Renamed';\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    Renamed (ComponentName1) message\n// [ INFO] - 0ms    Renamed (ComponentName2) message\n```\n\nThe context can be renamed from any one of the loggers and it will apply to all in the context.\n\n```javascript\nlog1.context('RenamedAgain');\n\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    RenamedAgain (ComponentName1) message\n// [ INFO] - 0ms    RenamedAgain (ComponentName2) message\n```\n\n### Format string\n\nWhen logging it is best not to pre-assemble the string to be logged because the cost of doing so is incurred even when the level being logged-to is not enabled.\n\neg. `log.debug('number: ' + theNumber);`\n\nInstead, use a format string in the first argument. The logger will perform the string assembly internally __only if the log level is enabled__.\n\neg. `log.debug('number: %d, string: %s, json: %j', theNumber, theString, theObject);`\n\n### Levels\n\n```javascript\nlog.fatal('message');\nlog.error('message');\nlog.warn('message');\nlog.info('message');\nlog.debug('message');\nlog.trace('message');\n\nlog.log('message'); // goes to debug\n```\n\nDebug and trace messages can also be logged as follows\n\n```javascript\nlog.$$DEBUG('message');\nlog.$$TRACE('message');\n```\n\nThis allows for confident matchability to enable substituting all debug and trace calls out of production deployments. \n\n### Configuration\n\n__It is important. The configure() must be called at least once.__\n\nShown with default values below.\n\n```javascript\nvar Logger = require('happn-logger');\n\nLogger.configure({\n  logCacheSize: 50,\n  logLevel: 'info',\n  logTimeDelta: true,\n  logStackTraces: true,\n  logComponents: [],\n  logMessageDelimiter: '\\t',\n  logDateFormat: null,\n  logLayout: null,\n  logFile: null,\n  logFileMaxSize: 20480,\n  logFileBackups: 10,\n  logFileNameAbsolute: true,\n  logger: null\n});\n```\n\n#### logCacheSize\n\nAn array of recent log event messages is kept in `Logger.cache`. This specifies the size of that array.\n\nEnvironment variable __LOG_CACHE_SIZE__ overrides.\n\neg. `LOG_CACHE_SIZE=5000 node myServer.js`\n\n#### logLevel\n\noff, fatal, error, warn, info, debug, trace, all\n\nEnvironment variable __LOG_LEVEL__ overrides.\n\neg. `LOG_LEVEL=off node myServer.js`\n\n#### logTimeDelta\n\nLog the number of milliseconds since the previous log message.\n\n#### logStackTraces\n\nIf the last argument to the logger is an error, log the stack trace in a second message.\n\n#### logComponents\n\nAn array of log component names. Filters out all info, debug and trace messages from all component not in the list.\n\nEnvironment variable __LOG_COMPONENTS__ overrides.\n\neg. `LOG_COMPONENTS=component1,component2 node myServer.js`\n\n#### logMessageDelimiter\n\nThe delimiter appears between the timeDelta and the message.\n\n#### logDateFormat\n\nBy default no date appears in the log to console. However, dates are looged when the console is redirected (piped) to file. By specifying this format dates also be written to console.\n\neg. `'yyyy-MM-dd hh:mm:ss.SSS'`\n\n#### logLayout\n\nThis allows for specifying of the full log line layout. \n\neg.\n```javascript\n  ...\n  logLayout: {\n    type: 'pattern',\n    pattern: '%d{yyyy-MM-dd hh:mm:ss.SSS} [%[%5.5p%]] - %m'\n  },\n  ...\n```\n\n#### logFile\n\nIf specified - the logger logs to file and console. \n\n__Note: Using the file logger will in most cases fail to capture a logged fatal event that brought your server down. The file write is asynchronous and the exiting process does not wait. The log from console redirected to file will include the error because console writes are synchronous.__\n\n#### logFileMaxSize, logFileBackups\n\nLimit disk resources used by log file. This specifies how big the log file is allowed to get before 'archiving' it, and how many archive backups should be kept.\n\nIt creates `.log` (the current log), `.log.1` (the previous log), `.log.2` (older), etc\n\n#### logFileLayout\n\nSame as logLayout above - but for the logFile not the console.\n\n#### logFileNameAbsolute\n\nSpecifies if the specified logFile is an \"absolute\" filename. Don't know why it matters. It's a log4js parameter.\n\n#### logger\n\nEnables passing in a full log4js config. All log4js config fragments from the preceding list are ignored in favour of this full config.\n\neg.\n```javascript\n  ...\n  logger: {\n    appenders: [\n      {\n        type: \"console\",\n        layout: {\n          type: 'pattern',\n          pattern: '%d{yyyy-MM-dd hh:mm:ss.SSS} [%[%5.5p%]] - %m'\n        }\n      }\n    ]\n  },\n  ...\n```\n\n\n### Events\n\nThe logger emits an event before and after each log message. This enables console applications, terminals and similar to prepare for and/or recover from the logger performing a console write.\n\neg.\n```javascript\n\nLogger.emitter.on('before', function() {\n  // Runs immediately before every log write.\n});\n\nLogger.emitter.on('after', function() {\n  // Runs immediately after every log write.\n});\n\n//you can also listen for the actual log message and level\nLogger.emitter.on('after', function(level, message) {\n\n  //level = info|error|warn|debug\n  //message = 1ms<tab>hello\n\n});\n\n```\n\n","readmeFilename":"README.md","_id":"happn-logger@2.2.6-prerelease-1","_nodeVersion":"18.17.1","_npmVersion":"9.6.7","dist":{"integrity":"sha512-Men9WFCkVbhf+4NGpRS+4EQJvEcNuzE+P9AuYOjRDL4BPm+ppoZ6rYQpc4KRpyabgvOf3Is8mGd4Y57XEDYd3Q==","shasum":"7d4482faf9e108ce4449256b4db83a7ee2dc0286","tarball":"https://registry.npmjs.org/happn-logger/-/happn-logger-2.2.6-prerelease-1.tgz","fileCount":6,"unpackedSize":23493,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAcwEW/zMBtE2YJO7NMkmLm6jTeyBDCeqhMZ0TBS9e5JAiAsmGa8K5l83YC48npbl6hY7Jgtlmtx8rxE81X+FyFw9w=="}]},"_npmUser":{"name":"jancoy","email":"janco@tenacious.digital"},"directories":{},"maintainers":[{"name":"nomilous","email":"nomilous@gmail.com"},{"name":"smc-tenacious","email":"eggers.jens@gmail.com"},{"name":"jancoy","email":"janco@tenacious.digital"},{"name":"simonbishopza","email":"simon.bishop.za@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/happn-logger_2.2.6-prerelease-1_1694686362300_0.5316454702139206"},"_hasShrinkwrap":false},"2.2.6-prerelease-3":{"name":"happn-logger","version":"2.2.6-prerelease-3","description":"Logger using log4js","main":"index.js","scripts":{"test":"_mocha --recursive --exit silence.js test/*","test-cover":"nyc --reporter=lcov --reporter=text-summary --reporter=html npm test"},"repository":{"type":"git","url":"git+https://github.com/happner/happn-logger.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/happner/happn-logger/issues"},"homepage":"https://github.com/happner/happn-logger#readme","devDependencies":{"capture-stdout":"^1.0.0","happn-commons-test":"1.2.3-prerelease-1"},"dependencies":{"log4js":"^6.3.0"},"readme":"[![Build Status](https://travis-ci.org/happner/happn-logger.svg?branch=master)](https://travis-ci.org/happner/happn-logger)\n\n# happn-logger\n\n`npm install happn-logger --save`\n\nLogger using log4js.\n\nOne instance of the logger is shared processwide. (global)\n\n## Usage\n\nWith context and component.\n\n```javascript\nvar Logger = require('happn-logger');\nvar context = Logger.createContext('ContextName');\nvar log = context.createLogger('ComponentName');\n\nlog.info('message');\n// [ INFO] - 1ms    ContextName (ComponentName) message\n\n// log can create a new component logger in the same context\nvar log2 = log.createLogger('AnotherComponent');\n\n```\n\nWith component only.\n\n```javascript\nvar Logger = require('happn-logger');\nvar log = Logger.createLogger('ComponentName');\n\nlog.info('message');\n// [ INFO] - 1ms    (ComponentName) message\n```\n\nCreating log functions on existing object.\n\n```javascript\nvar Logger = require('happn-logger');\n\nvar thing = new Thing();\nLogger.createLogger('thing', thing);\n\nthing.info('message');\n// [ INFO] - 1ms    (thing) message\n```\n\n### Context\n\nThe context of the logger can be modified. The change is applied to all loggers in that context.\n\n```javascript\nvar Logger = require('happn-logger');\nvar logContext = Logger.createContext('ContextName');\nvar log1 = logContext.createLogger('ComponentName1');\nvar log2 = logContext.createLogger('ComponentName2');\n\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    ContextName (ComponentName1) message\n// [ INFO] - 0ms    ContextName (ComponentName2) message\n\nlogContext.context = 'Renamed';\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    Renamed (ComponentName1) message\n// [ INFO] - 0ms    Renamed (ComponentName2) message\n```\n\nThe context can be renamed from any one of the loggers and it will apply to all in the context.\n\n```javascript\nlog1.context('RenamedAgain');\n\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    RenamedAgain (ComponentName1) message\n// [ INFO] - 0ms    RenamedAgain (ComponentName2) message\n```\n\n### Format string\n\nWhen logging it is best not to pre-assemble the string to be logged because the cost of doing so is incurred even when the level being logged-to is not enabled.\n\neg. `log.debug('number: ' + theNumber);`\n\nInstead, use a format string in the first argument. The logger will perform the string assembly internally __only if the log level is enabled__.\n\neg. `log.debug('number: %d, string: %s, json: %j', theNumber, theString, theObject);`\n\n### Levels\n\n```javascript\nlog.fatal('message');\nlog.error('message');\nlog.warn('message');\nlog.info('message');\nlog.debug('message');\nlog.trace('message');\n\nlog.log('message'); // goes to debug\n```\n\nDebug and trace messages can also be logged as follows\n\n```javascript\nlog.$$DEBUG('message');\nlog.$$TRACE('message');\n```\n\nThis allows for confident matchability to enable substituting all debug and trace calls out of production deployments. \n\n### Configuration\n\n__It is important. The configure() must be called at least once.__\n\nShown with default values below.\n\n```javascript\nvar Logger = require('happn-logger');\n\nLogger.configure({\n  logCacheSize: 50,\n  logLevel: 'info',\n  logTimeDelta: true,\n  logStackTraces: true,\n  logComponents: [],\n  logMessageDelimiter: '\\t',\n  logDateFormat: null,\n  logLayout: null,\n  logFile: null,\n  logFileMaxSize: 20480,\n  logFileBackups: 10,\n  logFileNameAbsolute: true,\n  logger: null\n});\n```\n\n#### logCacheSize\n\nAn array of recent log event messages is kept in `Logger.cache`. This specifies the size of that array.\n\nEnvironment variable __LOG_CACHE_SIZE__ overrides.\n\neg. `LOG_CACHE_SIZE=5000 node myServer.js`\n\n#### logLevel\n\noff, fatal, error, warn, info, debug, trace, all\n\nEnvironment variable __LOG_LEVEL__ overrides.\n\neg. `LOG_LEVEL=off node myServer.js`\n\n#### logTimeDelta\n\nLog the number of milliseconds since the previous log message.\n\n#### logStackTraces\n\nIf the last argument to the logger is an error, log the stack trace in a second message.\n\n#### logComponents\n\nAn array of log component names. Filters out all info, debug and trace messages from all component not in the list.\n\nEnvironment variable __LOG_COMPONENTS__ overrides.\n\neg. `LOG_COMPONENTS=component1,component2 node myServer.js`\n\n#### logMessageDelimiter\n\nThe delimiter appears between the timeDelta and the message.\n\n#### logDateFormat\n\nBy default no date appears in the log to console. However, dates are looged when the console is redirected (piped) to file. By specifying this format dates also be written to console.\n\neg. `'yyyy-MM-dd hh:mm:ss.SSS'`\n\n#### logLayout\n\nThis allows for specifying of the full log line layout. \n\neg.\n```javascript\n  ...\n  logLayout: {\n    type: 'pattern',\n    pattern: '%d{yyyy-MM-dd hh:mm:ss.SSS} [%[%5.5p%]] - %m'\n  },\n  ...\n```\n\n#### logFile\n\nIf specified - the logger logs to file and console. \n\n__Note: Using the file logger will in most cases fail to capture a logged fatal event that brought your server down. The file write is asynchronous and the exiting process does not wait. The log from console redirected to file will include the error because console writes are synchronous.__\n\n#### logFileMaxSize, logFileBackups\n\nLimit disk resources used by log file. This specifies how big the log file is allowed to get before 'archiving' it, and how many archive backups should be kept.\n\nIt creates `.log` (the current log), `.log.1` (the previous log), `.log.2` (older), etc\n\n#### logFileLayout\n\nSame as logLayout above - but for the logFile not the console.\n\n#### logFileNameAbsolute\n\nSpecifies if the specified logFile is an \"absolute\" filename. Don't know why it matters. It's a log4js parameter.\n\n#### logger\n\nEnables passing in a full log4js config. All log4js config fragments from the preceding list are ignored in favour of this full config.\n\neg.\n```javascript\n  ...\n  logger: {\n    appenders: [\n      {\n        type: \"console\",\n        layout: {\n          type: 'pattern',\n          pattern: '%d{yyyy-MM-dd hh:mm:ss.SSS} [%[%5.5p%]] - %m'\n        }\n      }\n    ]\n  },\n  ...\n```\n\n\n### Events\n\nThe logger emits an event before and after each log message. This enables console applications, terminals and similar to prepare for and/or recover from the logger performing a console write.\n\neg.\n```javascript\n\nLogger.emitter.on('before', function() {\n  // Runs immediately before every log write.\n});\n\nLogger.emitter.on('after', function() {\n  // Runs immediately after every log write.\n});\n\n//you can also listen for the actual log message and level\nLogger.emitter.on('after', function(level, message) {\n\n  //level = info|error|warn|debug\n  //message = 1ms<tab>hello\n\n});\n\n```\n\n","readmeFilename":"README.md","gitHead":"9cbfde6ba664b4398cea3e52ee0dc1fe5fc91a63","_id":"happn-logger@2.2.6-prerelease-3","_nodeVersion":"18.16.1","_npmVersion":"9.5.1","dist":{"integrity":"sha512-Cbx08hnzzzu8ZARI6bDZKB3piYtQREy+cVN4Vq+pTND27X5cmNRltnuCf6jn3PrhHHW9PszabecdMDC+bIbRpA==","shasum":"63938d21de377187b0efc976815e2cfe755d1dc0","tarball":"https://registry.npmjs.org/happn-logger/-/happn-logger-2.2.6-prerelease-3.tgz","fileCount":6,"unpackedSize":23560,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDfaUgQFmxDFc8rXoqappvD0Rdv4+oqtDjOQAwl5/A7CgIgK0Ls94xO8fSIaci/lhhuDpJyvDUAmiHBgbKzlPJdJb0="}]},"_npmUser":{"name":"erasmusjw","email":"Erasmusjw@gmail.com"},"directories":{},"maintainers":[{"name":"smc-tenacious","email":"eggers.jens@gmail.com"},{"name":"erasmusjw","email":"Erasmusjw@gmail.com"},{"name":"simonbishopza","email":"simon.bishop.za@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/happn-logger_2.2.6-prerelease-3_1696418608576_0.9422708687481038"},"_hasShrinkwrap":false},"2.2.6-prerelease-4":{"name":"happn-logger","version":"2.2.6-prerelease-4","description":"Logger using log4js","main":"index.js","scripts":{"test":"_mocha --recursive --exit silence.js test/*","test-cover":"nyc --reporter=lcov --reporter=text-summary --reporter=html npm test"},"repository":{"type":"git","url":"git+https://github.com/happner/happn-logger.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/happner/happn-logger/issues"},"homepage":"https://github.com/happner/happn-logger#readme","devDependencies":{"capture-stdout":"^1.0.0","happn-commons-test":"1.2.3-prerelease-2"},"dependencies":{"log4js":"^6.3.0"},"readme":"[![Build Status](https://travis-ci.org/happner/happn-logger.svg?branch=master)](https://travis-ci.org/happner/happn-logger)\n\n# happn-logger\n\n`npm install happn-logger --save`\n\nLogger using log4js.\n\nOne instance of the logger is shared processwide. (global)\n\n## Usage\n\nWith context and component.\n\n```javascript\nvar Logger = require('happn-logger');\nvar context = Logger.createContext('ContextName');\nvar log = context.createLogger('ComponentName');\n\nlog.info('message');\n// [ INFO] - 1ms    ContextName (ComponentName) message\n\n// log can create a new component logger in the same context\nvar log2 = log.createLogger('AnotherComponent');\n\n```\n\nWith component only.\n\n```javascript\nvar Logger = require('happn-logger');\nvar log = Logger.createLogger('ComponentName');\n\nlog.info('message');\n// [ INFO] - 1ms    (ComponentName) message\n```\n\nCreating log functions on existing object.\n\n```javascript\nvar Logger = require('happn-logger');\n\nvar thing = new Thing();\nLogger.createLogger('thing', thing);\n\nthing.info('message');\n// [ INFO] - 1ms    (thing) message\n```\n\n### Context\n\nThe context of the logger can be modified. The change is applied to all loggers in that context.\n\n```javascript\nvar Logger = require('happn-logger');\nvar logContext = Logger.createContext('ContextName');\nvar log1 = logContext.createLogger('ComponentName1');\nvar log2 = logContext.createLogger('ComponentName2');\n\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    ContextName (ComponentName1) message\n// [ INFO] - 0ms    ContextName (ComponentName2) message\n\nlogContext.context = 'Renamed';\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    Renamed (ComponentName1) message\n// [ INFO] - 0ms    Renamed (ComponentName2) message\n```\n\nThe context can be renamed from any one of the loggers and it will apply to all in the context.\n\n```javascript\nlog1.context('RenamedAgain');\n\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    RenamedAgain (ComponentName1) message\n// [ INFO] - 0ms    RenamedAgain (ComponentName2) message\n```\n\n### Format string\n\nWhen logging it is best not to pre-assemble the string to be logged because the cost of doing so is incurred even when the level being logged-to is not enabled.\n\neg. `log.debug('number: ' + theNumber);`\n\nInstead, use a format string in the first argument. The logger will perform the string assembly internally __only if the log level is enabled__.\n\neg. `log.debug('number: %d, string: %s, json: %j', theNumber, theString, theObject);`\n\n### Levels\n\n```javascript\nlog.fatal('message');\nlog.error('message');\nlog.warn('message');\nlog.info('message');\nlog.debug('message');\nlog.trace('message');\n\nlog.log('message'); // goes to debug\n```\n\nDebug and trace messages can also be logged as follows\n\n```javascript\nlog.$$DEBUG('message');\nlog.$$TRACE('message');\n```\n\nThis allows for confident matchability to enable substituting all debug and trace calls out of production deployments. \n\n### Configuration\n\n__It is important. The configure() must be called at least once.__\n\nShown with default values below.\n\n```javascript\nvar Logger = require('happn-logger');\n\nLogger.configure({\n  logCacheSize: 50,\n  logLevel: 'info',\n  logTimeDelta: true,\n  logStackTraces: true,\n  logComponents: [],\n  logMessageDelimiter: '\\t',\n  logDateFormat: null,\n  logLayout: null,\n  logFile: null,\n  logFileMaxSize: 20480,\n  logFileBackups: 10,\n  logFileNameAbsolute: true,\n  logger: null\n});\n```\n\n#### logCacheSize\n\nAn array of recent log event messages is kept in `Logger.cache`. This specifies the size of that array.\n\nEnvironment variable __LOG_CACHE_SIZE__ overrides.\n\neg. `LOG_CACHE_SIZE=5000 node myServer.js`\n\n#### logLevel\n\noff, fatal, error, warn, info, debug, trace, all\n\nEnvironment variable __LOG_LEVEL__ overrides.\n\neg. `LOG_LEVEL=off node myServer.js`\n\n#### logTimeDelta\n\nLog the number of milliseconds since the previous log message.\n\n#### logStackTraces\n\nIf the last argument to the logger is an error, log the stack trace in a second message.\n\n#### logComponents\n\nAn array of log component names. Filters out all info, debug and trace messages from all component not in the list.\n\nEnvironment variable __LOG_COMPONENTS__ overrides.\n\neg. `LOG_COMPONENTS=component1,component2 node myServer.js`\n\n#### logMessageDelimiter\n\nThe delimiter appears between the timeDelta and the message.\n\n#### logDateFormat\n\nBy default no date appears in the log to console. However, dates are looged when the console is redirected (piped) to file. By specifying this format dates also be written to console.\n\neg. `'yyyy-MM-dd hh:mm:ss.SSS'`\n\n#### logLayout\n\nThis allows for specifying of the full log line layout. \n\neg.\n```javascript\n  ...\n  logLayout: {\n    type: 'pattern',\n    pattern: '%d{yyyy-MM-dd hh:mm:ss.SSS} [%[%5.5p%]] - %m'\n  },\n  ...\n```\n\n#### logFile\n\nIf specified - the logger logs to file and console. \n\n__Note: Using the file logger will in most cases fail to capture a logged fatal event that brought your server down. The file write is asynchronous and the exiting process does not wait. The log from console redirected to file will include the error because console writes are synchronous.__\n\n#### logFileMaxSize, logFileBackups\n\nLimit disk resources used by log file. This specifies how big the log file is allowed to get before 'archiving' it, and how many archive backups should be kept.\n\nIt creates `.log` (the current log), `.log.1` (the previous log), `.log.2` (older), etc\n\n#### logFileLayout\n\nSame as logLayout above - but for the logFile not the console.\n\n#### logFileNameAbsolute\n\nSpecifies if the specified logFile is an \"absolute\" filename. Don't know why it matters. It's a log4js parameter.\n\n#### logger\n\nEnables passing in a full log4js config. All log4js config fragments from the preceding list are ignored in favour of this full config.\n\neg.\n```javascript\n  ...\n  logger: {\n    appenders: [\n      {\n        type: \"console\",\n        layout: {\n          type: 'pattern',\n          pattern: '%d{yyyy-MM-dd hh:mm:ss.SSS} [%[%5.5p%]] - %m'\n        }\n      }\n    ]\n  },\n  ...\n```\n\n\n### Events\n\nThe logger emits an event before and after each log message. This enables console applications, terminals and similar to prepare for and/or recover from the logger performing a console write.\n\neg.\n```javascript\n\nLogger.emitter.on('before', function() {\n  // Runs immediately before every log write.\n});\n\nLogger.emitter.on('after', function() {\n  // Runs immediately after every log write.\n});\n\n//you can also listen for the actual log message and level\nLogger.emitter.on('after', function(level, message) {\n\n  //level = info|error|warn|debug\n  //message = 1ms<tab>hello\n\n});\n\n```\n\n","readmeFilename":"README.md","gitHead":"66a5e844f5b3c8b43653a268348a03d2ba1a9e8c","_id":"happn-logger@2.2.6-prerelease-4","_nodeVersion":"16.13.1","_npmVersion":"8.5.4","dist":{"integrity":"sha512-NBWYJkkvRNXtCTU1do7bNXDL3Jc/agL6z5ICAngjgu8xGyiLaLvPw7KrfLhPXC9VBXRCKdg2d8EHYkPE3QOiqw==","shasum":"1180758eaf47b614a46d979a420381e64c967817","tarball":"https://registry.npmjs.org/happn-logger/-/happn-logger-2.2.6-prerelease-4.tgz","fileCount":6,"unpackedSize":23560,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDCNhgB4Oy6tVib6X4+nNDO2FJPWVTuXCQEbdSMcQXQzwIgSvv201WEgRrJ0wthPvFAQ8O9h/gRtmNs0p4X/RTv/Jo="}]},"_npmUser":{"name":"simonbishopza","email":"simon.bishop.za@gmail.com"},"directories":{},"maintainers":[{"name":"smc-tenacious","email":"eggers.jens@gmail.com"},{"name":"erasmusjw","email":"Erasmusjw@gmail.com"},{"name":"simonbishopza","email":"simon.bishop.za@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/happn-logger_2.2.6-prerelease-4_1703150147439_0.02439926938217507"},"_hasShrinkwrap":false},"2.2.6-prerelease-5":{"name":"happn-logger","version":"2.2.6-prerelease-5","description":"Logger using log4js","main":"index.js","scripts":{"test":"_mocha --recursive --exit silence.js test/*","test-cover":"nyc --reporter=lcov --reporter=text-summary --reporter=html npm test"},"repository":{"type":"git","url":"git+https://github.com/happner/happn-logger.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/happner/happn-logger/issues"},"homepage":"https://github.com/happner/happn-logger#readme","devDependencies":{"capture-stdout":"^1.0.0","happn-commons-test":"1.2.3-prerelease-3"},"dependencies":{"log4js":"^6.3.0"},"readme":"[![Build Status](https://travis-ci.org/happner/happn-logger.svg?branch=master)](https://travis-ci.org/happner/happn-logger)\n\n# happn-logger\n\n`npm install happn-logger --save`\n\nLogger using log4js.\n\nOne instance of the logger is shared processwide. (global)\n\n## Usage\n\nWith context and component.\n\n```javascript\nvar Logger = require('happn-logger');\nvar context = Logger.createContext('ContextName');\nvar log = context.createLogger('ComponentName');\n\nlog.info('message');\n// [ INFO] - 1ms    ContextName (ComponentName) message\n\n// log can create a new component logger in the same context\nvar log2 = log.createLogger('AnotherComponent');\n\n```\n\nWith component only.\n\n```javascript\nvar Logger = require('happn-logger');\nvar log = Logger.createLogger('ComponentName');\n\nlog.info('message');\n// [ INFO] - 1ms    (ComponentName) message\n```\n\nCreating log functions on existing object.\n\n```javascript\nvar Logger = require('happn-logger');\n\nvar thing = new Thing();\nLogger.createLogger('thing', thing);\n\nthing.info('message');\n// [ INFO] - 1ms    (thing) message\n```\n\n### Context\n\nThe context of the logger can be modified. The change is applied to all loggers in that context.\n\n```javascript\nvar Logger = require('happn-logger');\nvar logContext = Logger.createContext('ContextName');\nvar log1 = logContext.createLogger('ComponentName1');\nvar log2 = logContext.createLogger('ComponentName2');\n\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    ContextName (ComponentName1) message\n// [ INFO] - 0ms    ContextName (ComponentName2) message\n\nlogContext.context = 'Renamed';\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    Renamed (ComponentName1) message\n// [ INFO] - 0ms    Renamed (ComponentName2) message\n```\n\nThe context can be renamed from any one of the loggers and it will apply to all in the context.\n\n```javascript\nlog1.context('RenamedAgain');\n\nlog1.info('message');\nlog2.info('message');\n// [ INFO] - 0ms    RenamedAgain (ComponentName1) message\n// [ INFO] - 0ms    RenamedAgain (ComponentName2) message\n```\n\n### Format string\n\nWhen logging it is best not to pre-assemble the string to be logged because the cost of doing so is incurred even when the level being logged-to is not enabled.\n\neg. `log.debug('number: ' + theNumber);`\n\nInstead, use a format string in the first argument. The logger will perform the string assembly internally __only if the log level is enabled__.\n\neg. `log.debug('number: %d, string: %s, json: %j', theNumber, theString, theObject);`\n\n### Levels\n\n```javascript\nlog.fatal('message');\nlog.error('message');\nlog.warn('message');\nlog.info('message');\nlog.debug('message');\nlog.trace('message');\n\nlog.log('message'); // goes to debug\n```\n\nDebug and trace messages can also be logged as follows\n\n```javascript\nlog.$$DEBUG('message');\nlog.$$TRACE('message');\n```\n\nThis allows for confident matchability to enable substituting all debug and trace calls out of production deployments. \n\n### Configuration\n\n__It is important. The configure() must be called at least once.__\n\nShown with default values below.\n\n```javascript\nvar Logger = require('happn-logger');\n\nLogger.configure({\n  logCacheSize: 50,\n  logLevel: 'info',\n  logTimeDelta: true,\n  logStackTraces: true,\n  logComponents: [],\n  logMessageDelimiter: '\\t',\n  logDateFormat: null,\n  logLayout: null,\n  logFile: null,\n  logFileMaxSize: 20480,\n  logFileBackups: 10,\n  logFileNameAbsolute: true,\n  logger: null\n});\n```\n\n#### logCacheSize\n\nAn array of recent log event messages is kept in `Logger.cache`. This specifies the size of that array.\n\nEnvironment variable __LOG_CACHE_SIZE__ overrides.\n\neg. `LOG_CACHE_SIZE=5000 node myServer.js`\n\n#### logLevel\n\noff, fatal, error, warn, info, debug, trace, all\n\nEnvironment variable __LOG_LEVEL__ overrides.\n\neg. `LOG_LEVEL=off node myServer.js`\n\n#### logTimeDelta\n\nLog the number of milliseconds since the previous log message.\n\n#### logStackTraces\n\nIf the last argument to the logger is an error, log the stack trace in a second message.\n\n#### logComponents\n\nAn array of log component names. Filters out all info, debug and trace messages from all component not in the list.\n\nEnvironment variable __LOG_COMPONENTS__ overrides.\n\neg. `LOG_COMPONENTS=component1,component2 node myServer.js`\n\n#### logMessageDelimiter\n\nThe delimiter appears between the timeDelta and the message.\n\n#### logDateFormat\n\nBy default no date appears in the log to console. However, dates are looged when the console is redirected (piped) to file. By specifying this format dates also be written to console.\n\neg. `'yyyy-MM-dd hh:mm:ss.SSS'`\n\n#### logLayout\n\nThis allows for specifying of the full log line layout. \n\neg.\n```javascript\n  ...\n  logLayout: {\n    type: 'pattern',\n    pattern: '%d{yyyy-MM-dd hh:mm:ss.SSS} [%[%5.5p%]] - %m'\n  },\n  ...\n```\n\n#### logFile\n\nIf specified - the logger logs to file and console. \n\n__Note: Using the file logger will in most cases fail to capture a logged fatal event that brought your server down. The file write is asynchronous and the exiting process does not wait. The log from console redirected to file will include the error because console writes are synchronous.__\n\n#### logFileMaxSize, logFileBackups\n\nLimit disk resources used by log file. This specifies how big the log file is allowed to get before 'archiving' it, and how many archive backups should be kept.\n\nIt creates `.log` (the current log), `.log.1` (the previous log), `.log.2` (older), etc\n\n#### logFileLayout\n\nSame as logLayout above - but for the logFile not the console.\n\n#### logFileNameAbsolute\n\nSpecifies if the specified logFile is an \"absolute\" filename. Don't know why it matters. It's a log4js parameter.\n\n#### logger\n\nEnables passing in a full log4js config. All log4js config fragments from the preceding list are ignored in favour of this full config.\n\neg.\n```javascript\n  ...\n  logger: {\n    appenders: [\n      {\n        type: \"console\",\n        layout: {\n          type: 'pattern',\n          pattern: '%d{yyyy-MM-dd hh:mm:ss.SSS} [%[%5.5p%]] - %m'\n        }\n      }\n    ]\n  },\n  ...\n```\n\n\n### Events\n\nThe logger emits an event before and after each log message. This enables console applications, terminals and similar to prepare for and/or recover from the logger performing a console write.\n\neg.\n```javascript\n\nLogger.emitter.on('before', function() {\n  // Runs immediately before every log write.\n});\n\nLogger.emitter.on('after', function() {\n  // Runs immediately after every log write.\n});\n\n//you can also listen for the actual log message and level\nLogger.emitter.on('after', function(level, message) {\n\n  //level = info|error|warn|debug\n  //message = 1ms<tab>hello\n\n});\n\n```\n\n","readmeFilename":"README.md","gitHead":"66a5e844f5b3c8b43653a268348a03d2ba1a9e8c","_id":"happn-logger@2.2.6-prerelease-5","_nodeVersion":"16.13.1","_npmVersion":"8.5.4","dist":{"integrity":"sha512-CK1HFFFtIDaSO0R0h0U+bLAmxQHu5HT9seU9GKs78PbaZBSQDxTpUFLFfkrmRE/kvK2qyKJsNevCqpciM12eQw==","shasum":"98fed7799afc1b4e70e138fcffa0da0bdb815ab9","tarball":"https://registry.npmjs.org/happn-logger/-/happn-logger-2.2.6-prerelease-5.tgz","fileCount":6,"unpackedSize":23560,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCUKeLGsEcjqHhdrMnPDl7jzpjPdc7pbfqMN7rpV/Vv8AIgQDA+cEaYBXeSZQygD0v+/ayLITJnViLe68Jj1Xjse+o="}]},"_npmUser":{"name":"simonbishopza","email":"simon.bishop.za@gmail.com"},"directories":{},"maintainers":[{"name":"smc-tenacious","email":"eggers.jens@gmail.com"},{"name":"erasmusjw","email":"Erasmusjw@gmail.com"},{"name":"simonbishopza","email":"simon.bishop.za@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/happn-logger_2.2.6-prerelease-5_1703153646825_0.8655465936522742"},"_hasShrinkwrap":false}},"readme":"","maintainers":[{"name":"smc-tenacious","email":"eggers.jens@gmail.com"},{"name":"erasmusjw","email":"Erasmusjw@gmail.com"},{"name":"simonbishopza","email":"simon.bishop.za@gmail.com"}],"time":{"modified":"2023-12-21T10:14:07.167Z","created":"2015-12-06T20:20:00.197Z","0.0.1":"2015-12-06T20:20:00.197Z","0.0.2":"2016-05-20T08:08:33.194Z","0.1.0":"2019-04-12T11:43:22.889Z","0.1.1":"2019-04-18T06:43:08.367Z","0.1.2":"2019-05-10T12:53:43.618Z","1.0.0-prerelease-1":"2020-11-12T14:50:40.565Z","1.0.0-prerelease-2":"2020-11-17T13:55:24.024Z","1.0.0":"2020-11-19T06:55:12.126Z","1.1.0":"2020-11-19T08:35:00.777Z","1.1.1":"2020-11-23T11:26:05.268Z","2.0.0":"2022-03-01T20:10:23.031Z","2.0.1":"2022-03-03T12:59:16.023Z","2.0.2":"2022-03-11T11:34:28.738Z","2.0.3":"2022-03-30T06:51:46.970Z","2.0.4-prerelease.1":"2022-05-17T15:01:02.883Z","2.1.0":"2022-05-27T16:04:06.387Z","2.1.1-prerelease-1":"2022-07-14T11:54:35.899Z","2.1.1-prerelease-2":"2022-07-14T13:47:28.733Z","2.1.1":"2022-07-21T08:03:51.539Z","2.2.0-prerelease-2":"2022-09-08T09:39:51.637Z","2.2.0-prerelease-3":"2022-09-08T13:47:25.132Z","2.2.0":"2022-09-13T11:39:53.449Z","2.2.1":"2022-11-01T13:58:51.913Z","2.2.2":"2022-11-26T11:02:49.040Z","2.2.3-prerelease-1":"2023-01-11T17:14:46.521Z","2.2.3":"2023-01-18T10:59:23.006Z","2.2.4-prerelease-1":"2023-01-18T13:57:08.350Z","2.2.4-prerelease-2":"2023-01-26T10:39:53.526Z","2.2.4":"2023-02-06T11:51:54.313Z","2.2.5":"2023-08-06T11:51:23.954Z","2.2.6-prerelease-1":"2023-09-14T10:12:42.499Z","2.2.6-prerelease-3":"2023-10-04T11:23:28.784Z","2.2.6-prerelease-4":"2023-12-21T09:15:47.620Z","2.2.6-prerelease-5":"2023-12-21T10:14:07.003Z"},"homepage":"https://github.com/happner/happn-logger#readme","repository":{"type":"git","url":"git+https://github.com/happner/happn-logger.git"},"bugs":{"url":"https://github.com/happner/happn-logger/issues"},"license":"MIT","readmeFilename":""}