{"_id":"logan","_rev":"2795195","name":"logan","description":"Mini template system for the console and colors","dist-tags":{"latest":"0.0.2"},"maintainers":[{"name":"typicode","email":"typicode@gmail.com"}],"time":{"modified":"2022-07-11T15:51:10.000Z","created":"2013-11-12T11:06:02.570Z","0.0.2":"2013-11-18T13:03:31.242Z","0.0.1":"2013-11-12T11:06:02.570Z"},"users":{},"author":{"name":"Typicode"},"repository":{"type":"git","url":"git://github.com/typicode/logan.git"},"versions":{"0.0.2":{"name":"logan","version":"0.0.2","description":"Mini template system for the console and colors","main":"index.js","scripts":{"test":"node test"},"repository":{"type":"git","url":"git://github.com/typicode/logan.git"},"keywords":["colors","console","log","template"],"dependencies":{"colors":"*"},"author":{"name":"Typicode"},"license":"MIT","readmeFilename":"README.md","bugs":{"url":"https://github.com/typicode/logan/issues"},"homepage":"https://github.com/typicode/logan","_id":"logan@0.0.2","dist":{"shasum":"bb7096fd860afd119045d942e91b74d156b32051","size":3176,"noattachment":false,"key":"/logan/-/logan-0.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/logan/download/logan-0.0.2.tgz"},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"typicode","email":"typicode@gmail.com"},"maintainers":[{"name":"typicode","email":"typicode@gmail.com"}],"directories":{},"publish_time":1384779811242,"_hasShrinkwrap":false,"_cnpm_publish_time":1384779811242,"_cnpmcore_publish_time":"2021-12-16T21:24:04.556Z"},"0.0.1":{"name":"logan","version":"0.0.1","description":"Mini template system for the console and colors","main":"index.js","scripts":{"test":"node test"},"repository":{"type":"git","url":"git://github.com/typicode/logan.git"},"keywords":["colors","console","log","template"],"dependencies":{"colors":"*"},"author":{"name":"Typicode"},"license":"MIT","readmeFilename":"README.md","bugs":{"url":"https://github.com/typicode/logan/issues"},"_id":"logan@0.0.1","dist":{"shasum":"6058cc8390a8e876e5520fb577f7d85c938593b6","size":3017,"noattachment":false,"key":"/logan/-/logan-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/logan/download/logan-0.0.1.tgz"},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"typicode","email":"typicode@gmail.com"},"maintainers":[{"name":"typicode","email":"typicode@gmail.com"}],"directories":{},"publish_time":1384254362570,"_hasShrinkwrap":false,"_cnpm_publish_time":1384254362570,"_cnpmcore_publish_time":"2021-12-16T21:24:04.748Z"}},"readme":"# Logan\n\n![](http://i.imgur.com/xg4wt5j.png)\n\nLogan is a mini template system for the console and [colors](https://github.com/Marak/colors.js). \n\nIt allows to cleanly separate content from style and create beautiful logging functions.\n\n## Example\n\nLet's say you want to write a logging function that says hello.\n\n```javascript\n// Without Logan\nfunction hello(arg) {\n  console.log('Hello'.bold.green + ' : ' + arg.cyan);\n}\n\n// With Logan\nvar hello = logan.create('Hello : %', 'bold.green . cyan')\n\nhello('world');\n```\n\n![](http://i.imgur.com/4I6nDTp.png)\n\n## Usage\n\n```javascript\nvar logan = require('logan');\n```\n\n### set\n\nThis is the most useful method of logan. It lets you define all your templates in one place.\n\n```javascript\nlogan.set({\n  info: ['info : %', 'yellow'],\n  warn: ['warn : %', 'orange'],\n  omg : ['omg  : %', 'rainbow']\n});\n\nlogan.info('some info');\n```\n\nNotice how easy it is to see what all your logging functions will output.\n\nAlso, with ```set``` your module users can easily theme logs:\n\n```javascript\n// Overriding omg to be... more OMG!!!\nlogan.set({\n  omg: ['OMG : % !!!', 'red . . red']\n});\n```\n\n### create\n\nReturns a logging function.\n\n```javascript\nvar info = logan.create('info : %', 'yellow');\ninfo('some text');\n```\n\n### compile\n\nReturns a function which returns a string when called.\n\n```javascript\nvar info = logan.compile('info : %', 'yellow');\nconsole.log(info('some text'));\n```\n\n## Syntax\n\n* **%** is used for string replacement.\n* **{}** lets you define blocks.\n* **.** means default style.\n* styles can be chained (example: bold.underline.red).\n\n**{}** usage:\n\n```javascript\n// for example, instead of writing this:\nvar foo = logan.create('some long green string', 'green green green green');\n\n// using {} you can write\nvar foo = logan.create('{some long green string}', 'green');\n```\n\n## About the name\n\nSince there's a templating engine called [hogan](http://twitter.github.io/hogan.js/) and this one is about logging, it was called logan.\n\n## More\n\nIf you want to see how Logan can be used in another project, you can have a look at [ShoutJS](https://github.com/typicode/shoutjs).","_attachments":{},"readmeFilename":"README.md","homepage":"https://github.com/typicode/logan","bugs":{"url":"https://github.com/typicode/logan/issues"},"license":"MIT"}