{"_id":"@cool-blue/logevents","_rev":"11-9148bdae6fc48b8d088eccde81566af7","name":"@cool-blue/logevents","time":{"modified":"2022-06-12T16:40:56.533Z","created":"2016-07-25T05:07:23.076Z","1.0.0":"2016-07-25T05:07:23.076Z","1.0.1":"2016-07-25T16:34:16.682Z","0.0.1":"2016-07-25T16:54:01.515Z","0.0.2":"2016-07-29T07:24:19.080Z","0.0.3":"2016-07-29T07:29:24.636Z","0.1.0":"2016-08-03T07:32:30.043Z","0.2.0":"2016-08-07T04:36:25.097Z","0.2.1":"2016-08-07T05:57:32.686Z"},"maintainers":[{"name":"cool-blue","email":"cool.blue@y7mail.com"}],"dist-tags":{"latest":"0.2.1"},"description":"listens to an array of events on an object and outputs to a specified file or stream","readme":"# log-events\r\n\r\nA very basic event logger that lets you apply one hook to an event that will log to the provided stream in color.\r\n\r\nFor simplicity, any event on any emitter can only be hooked once with this app.  Multiple hooks on the same event simply result in the previous one being replaced.\r\n\r\n## Usage\r\n\r\n`npm install @cool-blue/logevents`\r\n\r\n### Exports a constructor\r\n    const  LogEvents = require('@cool-blue/logevents'),\r\n    \r\n    const logEvents = LogEvents()   // outputs to stdout\r\n    const logEvents = LogEvents(_validPath_)   // outputs to a file\r\n    const logEvents = LogEvents(_writeStream_)   // outputs to a stream\r\n\r\n### Exposes some utility functions\r\n\r\n**_\\#.open_** applies hooks to an event emitter\r\n\r\n    const events = ['event1', 'event2', 'event3'];\r\n    \r\n    logEvents().open(eventEmitter, events)  // logs the specified events\r\n    logEvents().open(eventEmitter, events, 'event2')  // logs all except event2\r\n    logEvents().open(eventEmitter, events, ['event2'])  // logs all except event2\r\n    logEvents().open(eventEmitter, 'event1')  // logs event1\r\n    \r\n    const objEvents = events.map(function(e){\r\n        return {\r\n            type: e,\r\n            action: function(){ console.log(this.name) },\r\n        }\r\n    });\r\n    \r\n    // logs the specified events and performs the specified action\r\n    logEvents().open(eventEmitter, objEvents)\r\n    \r\n    const objSomeEvents = someEvents.map(function(e){\r\n        return {\r\n            type: e,\r\n            action: function(){ console.log(this.name) },\r\n            add_remove: false\r\n        }\r\n    });\r\n    \r\n    // un-hooks/hooks events if add_remove is true/false\r\n    logEvents().open(eventEmitter, objSomeEvents)\r\n\r\n**_\\#.open.defaultActions_**([{type: {function}])\r\n\r\n  sets persistent default actions for indicated event types\r\n  there are preset default actions on `data` and `end` event types to `unshift` the chunk returned to the listener.\r\n    \r\n  Setting the action to a falsey value will remove the default action for the event type.\r\n  Adding an action that is already included will replace that action\r\n  \r\n**_\\#.logger_** provides a few color formatting options to help highlight the output\r\n\r\n    log.h1(_message_)   // default styles...\r\n    log.h2(_message_)\r\n    log.h3(_message_)\r\n    log.plain()         // without escape sequences (for non-TTY output)\r\n    log.fancy()         // to restore the default behaviour of colourised output\r\n    \r\nThe default behaviour is to issue [ANSI escape sequences](http://ascii-table.com/ansi-escape-sequences.php) to highlight the different styles.\r\n\r\n","versions":{"0.0.1":{"name":"@cool-blue/logevents","version":"0.0.1","description":"listens to an array of events on an object and outputs to a specified file or stream","main":"index.js","scripts":{"test":"cross-env NODE_ENV=test mocha"},"keywords":["log","stream","events"],"author":{"name":"cool.blue"},"license":"MIT","dependencies":{"left-pad":"^1.1.1","moment":"^2.14.1"},"devDependencies":{"cross-env":"^2.0.0","glob":"^7.0.5","mocha":"^2.5.3","chai":"^1.10.0"},"repository":{"type":"git","url":"git+https://github.com/cool-Blue/log-events.git"},"bugs":{"url":"https://github.com/cool-Blue/log-events/issues"},"homepage":"https://github.com/cool-Blue/log-events#readme","gitHead":"ecb110b111fe29fe0de70a0e267831120cad2f33","_id":"@cool-blue/logevents@0.0.1","_shasum":"e00f3bd1039c574dca8bf508f17da3d3beb87fd5","_from":".","_npmVersion":"3.8.6","_nodeVersion":"5.12.0","_npmUser":{"name":"cool-blue","email":"cool.blue@y7mail.com"},"dist":{"shasum":"e00f3bd1039c574dca8bf508f17da3d3beb87fd5","tarball":"https://registry.npmjs.org/@cool-blue/logevents/-/logevents-0.0.1.tgz","integrity":"sha512-QpU+OIO5EeTY2iDP3mQDSUfCXiHWxc5C7Tus8qTjpcCG9noZlvZcs22fk7Kk7u3eEkUlvxygAxrgTdekdRd8jQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIExqhsKV8dVrvkJPYYlt0AMFUUdeWGGa2/j/xsO32scAAiAbWQTdmX8a78wbAO705dLEu+b4DUdV7clAUpexeKGpHg=="}]},"maintainers":[{"name":"cool-blue","email":"cool.blue@y7mail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/logevents-0.0.1.tgz_1469465641274_0.27271258970722556"}},"0.0.2":{"name":"@cool-blue/logevents","version":"0.0.2","description":"listens to an array of events on an object and outputs to a specified file or stream","main":"index.js","scripts":{"test":"cross-env NODE_ENV=test mocha"},"keywords":["log","stream","events"],"author":{"name":"cool.blue"},"license":"MIT","dependencies":{"left-pad":"^1.1.1","moment":"^2.14.1"},"devDependencies":{"cross-env":"^2.0.0","glob":"^7.0.5","mocha":"^2.5.3","chai":"^1.10.0"},"repository":{"type":"git","url":"git+https://github.com/cool-Blue/log-events.git"},"bugs":{"url":"https://github.com/cool-Blue/log-events/issues"},"homepage":"https://github.com/cool-Blue/log-events#readme","gitHead":"24ae185cb66afcefd5c1eecf7af1b5215faba442","_id":"@cool-blue/logevents@0.0.2","_shasum":"13f145330e0b2349f4dd8953857e298bac064efc","_from":".","_npmVersion":"3.8.6","_nodeVersion":"5.12.0","_npmUser":{"name":"cool-blue","email":"cool.blue@y7mail.com"},"dist":{"shasum":"13f145330e0b2349f4dd8953857e298bac064efc","tarball":"https://registry.npmjs.org/@cool-blue/logevents/-/logevents-0.0.2.tgz","integrity":"sha512-2x6qLiwnjsS9EJxLGo1LsOvl6ZCh+TGbTdFS+BU2pHIQL6Wi8Zl0GtQ/bm4JmbLgq5RxeJghf/ZBkXi9ltdPHw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIH+LESAP80zgl0M5N30Qiez1r6y+QJVzFc0rE6iqiU1fAiEAn7y+V2iaAZj7nGBZXg4Yj73S9V9s1pGUZa0HT6uVjaM="}]},"maintainers":[{"name":"cool-blue","email":"cool.blue@y7mail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/logevents-0.0.2.tgz_1469777055343_0.0906462527345866"}},"0.0.3":{"name":"@cool-blue/logevents","version":"0.0.3","description":"listens to an array of events on an object and outputs to a specified file or stream","main":"index.js","scripts":{"test":"cross-env NODE_ENV=test mocha"},"keywords":["log","stream","events"],"author":{"name":"cool.blue"},"license":"MIT","dependencies":{"left-pad":"^1.1.1","moment":"^2.14.1"},"devDependencies":{"cross-env":"^2.0.0","glob":"^7.0.5","mocha":"^2.5.3","chai":"^1.10.0"},"repository":{"type":"git","url":"git+https://github.com/cool-Blue/log-events.git"},"bugs":{"url":"https://github.com/cool-Blue/log-events/issues"},"homepage":"https://github.com/cool-Blue/log-events#readme","gitHead":"24ae185cb66afcefd5c1eecf7af1b5215faba442","_id":"@cool-blue/logevents@0.0.3","_shasum":"cfc3e67603cc180bdaca2911eb9078bc41df133a","_from":".","_npmVersion":"3.8.6","_nodeVersion":"5.12.0","_npmUser":{"name":"cool-blue","email":"cool.blue@y7mail.com"},"dist":{"shasum":"cfc3e67603cc180bdaca2911eb9078bc41df133a","tarball":"https://registry.npmjs.org/@cool-blue/logevents/-/logevents-0.0.3.tgz","integrity":"sha512-0N0n3A8vyUS2BoOvRFxfW5y+1QFqVZG0IvjqRwNGEAVm0LNxBP2nPpytdwJZhdDB/am1VpHNFSZXt5P9fbJO3A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFMwQCCxvrryQ2JxnhqXkE5aOcxqzhZGMSpkZSkWu6e6AiEAl9hFVYKrNp+AdKE1qbI69Y+AD9CHZ7Fk+0ODkoyFikI="}]},"maintainers":[{"name":"cool-blue","email":"cool.blue@y7mail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/logevents-0.0.3.tgz_1469777364383_0.00624053948558867"}},"0.1.0":{"name":"@cool-blue/logevents","version":"0.1.0","description":"listens to an array of events on an object and outputs to a specified file or stream","main":"index.js","scripts":{"test":"cross-env NODE_ENV=test mocha"},"keywords":["log","stream","events"],"author":{"name":"cool.blue"},"license":"MIT","dependencies":{"left-pad":"^1.1.1","moment":"^2.14.1"},"devDependencies":{"cross-env":"^2.0.0","glob":"^7.0.5","mocha":"^2.5.3","chai":"^1.10.0"},"repository":{"type":"git","url":"git+https://github.com/cool-Blue/log-events.git"},"bugs":{"url":"https://github.com/cool-Blue/log-events/issues"},"homepage":"https://github.com/cool-Blue/log-events#readme","gitHead":"ab9b4a57d94c1e4a67f32b5f3c97e8d108f141db","_id":"@cool-blue/logevents@0.1.0","_shasum":"d15401ea25ecd0f80b96bce0703351b8cd844c0c","_from":".","_npmVersion":"3.8.6","_nodeVersion":"5.12.0","_npmUser":{"name":"cool-blue","email":"cool.blue@y7mail.com"},"dist":{"shasum":"d15401ea25ecd0f80b96bce0703351b8cd844c0c","tarball":"https://registry.npmjs.org/@cool-blue/logevents/-/logevents-0.1.0.tgz","integrity":"sha512-QjdWbfyDfdHSXAT9NzxXyBcWJ0lJv1iCY24V3sSNMFZEvxuT0Yy085L88K7GWeOyXBwltwhHsdIwIwFeLyN2VA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDXVjtbbUVPI5LeE6cHqBUh5aiE80nf60jCfNIBji26SwIgNSi0xbSeq2gIPuZjQf1nc53m33pGPVas5qFXlsmc190="}]},"maintainers":[{"name":"cool-blue","email":"cool.blue@y7mail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/logevents-0.1.0.tgz_1470209547827_0.8605335280299187"}},"0.2.0":{"name":"@cool-blue/logevents","version":"0.2.0","description":"listens to an array of events on an object and outputs to a specified file or stream","main":"index.js","scripts":{"test":"cross-env NODE_ENV=test mocha"},"keywords":["log","stream","events"],"author":{"name":"cool.blue"},"license":"MIT","dependencies":{"left-pad":"^1.1.1","moment":"^2.14.1"},"devDependencies":{"chai":"^1.10.0","cross-env":"^2.0.0","glob":"^7.0.5","mocha":"^2.5.3"},"repository":{"type":"git","url":"git+https://github.com/cool-Blue/log-events.git"},"bugs":{"url":"https://github.com/cool-Blue/log-events/issues"},"homepage":"https://github.com/cool-Blue/log-events#readme","gitHead":"7eced33fc2872c5294de2096525f52fe80ab621c","_id":"@cool-blue/logevents@0.2.0","_shasum":"c827272ecc3f2f4f81b511fcb627a76636b4c075","_from":".","_npmVersion":"3.8.6","_nodeVersion":"5.12.0","_npmUser":{"name":"cool-blue","email":"cool.blue@y7mail.com"},"dist":{"shasum":"c827272ecc3f2f4f81b511fcb627a76636b4c075","tarball":"https://registry.npmjs.org/@cool-blue/logevents/-/logevents-0.2.0.tgz","integrity":"sha512-kFIQio0WkRmWvRi310V450aMvtKFG//JoKjwOWLwYfCAViCZUY/pKD0mYmGgUUccImd2YMMF7Pqxe+nel5anrw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDS9mHtj6TOPT+PeqFW8GrIzmodp7/vdNkOVI61QL1GHAiBnSC6qu2f45oaGNcHj1QxrqEXIIieyccxB8xK0LHvI/Q=="}]},"maintainers":[{"name":"cool-blue","email":"cool.blue@y7mail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/logevents-0.2.0.tgz_1470544581795_0.021340396022424102"}},"0.2.1":{"name":"@cool-blue/logevents","version":"0.2.1","description":"listens to an array of events on an object and outputs to a specified file or stream","main":"index.js","scripts":{"test":"cross-env NODE_ENV=test mocha"},"keywords":["log","stream","events"],"author":{"name":"cool.blue"},"license":"MIT","dependencies":{"left-pad":"^1.1.1","moment":"^2.14.1"},"devDependencies":{"chai":"^1.10.0","cross-env":"^2.0.0","glob":"^7.0.5","mocha":"^2.5.3"},"repository":{"type":"git","url":"git+https://github.com/cool-Blue/log-events.git"},"bugs":{"url":"https://github.com/cool-Blue/log-events/issues"},"homepage":"https://github.com/cool-Blue/log-events#readme","gitHead":"bbf09d255a39a5b7cab4fbc024b49125ba35d7e3","_id":"@cool-blue/logevents@0.2.1","_shasum":"9e50dd424b3b04e5fb29d982c610093ed3239778","_from":".","_npmVersion":"3.8.6","_nodeVersion":"5.12.0","_npmUser":{"name":"cool-blue","email":"cool.blue@y7mail.com"},"dist":{"shasum":"9e50dd424b3b04e5fb29d982c610093ed3239778","tarball":"https://registry.npmjs.org/@cool-blue/logevents/-/logevents-0.2.1.tgz","integrity":"sha512-BfmMrcxH0g0pNcizS+b6aFNREOlcIP+GE46/1pBxtJem2eltpjXbNnGyIpv57l+YbkhvuY7OzHrbYa9Np1fOSA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCtuRklorQTMqYsGaCzIJNjS3qXWHDPRsJKpR65XBkonAIgNT1Ow3amhPwPquU2FwlZXqEoe9yB/ivYj1T8QszH2Vc="}]},"maintainers":[{"name":"cool-blue","email":"cool.blue@y7mail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/logevents-0.2.1.tgz_1470549449575_0.8256673670839518"}}},"homepage":"https://github.com/cool-Blue/log-events#readme","keywords":["log","stream","events"],"repository":{"type":"git","url":"git+https://github.com/cool-Blue/log-events.git"},"author":{"name":"cool.blue"},"bugs":{"url":"https://github.com/cool-Blue/log-events/issues"},"license":"MIT","readmeFilename":"readme.md"}