{"id":23663436,"url":"https://github.com/eyolas/yanlog","last_synced_at":"2025-12-06T09:30:20.429Z","repository":{"id":18988603,"uuid":"22210254","full_name":"eyolas/yanlog","owner":"eyolas","description":"Wrapper of winston for easy configuration","archived":false,"fork":false,"pushed_at":"2014-09-30T11:36:31.000Z","size":284,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-30T06:34:40.241Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eyolas.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-24T11:20:41.000Z","updated_at":"2014-09-30T11:28:54.000Z","dependencies_parsed_at":"2022-07-26T23:46:17.529Z","dependency_job_id":null,"html_url":"https://github.com/eyolas/yanlog","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eyolas%2Fyanlog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eyolas%2Fyanlog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eyolas%2Fyanlog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eyolas%2Fyanlog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eyolas","download_url":"https://codeload.github.com/eyolas/yanlog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239662734,"owners_count":19676435,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-29T05:28:20.622Z","updated_at":"2025-12-06T09:30:20.108Z","avatar_url":"https://github.com/eyolas.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![NPM version][npm-image]][npm-url]\n[![Dependencies][gemnasium-image]][gemnasium-url]\n\nyanlog\n======\n\nWrapper of [winston](https://github.com/flatiron/winston) for easy configuration.\nInspired by [debug](https://github.com/visionmedia/debug) and [logback](http://logback.qos.ch/)\n\n\n## Installation\n\n```bash\n$ npm install yanlog\n```\n\n## Usage\n\n With `yanlog` you simply invoke the exported function to generate your logger function, passing it a name which will determine the winston wrapper that is returned.\n\n On first invoke, yanlog is going to load the first yanlog.js in app path.\n\n if yanlog's config file is find, every 30s yanlog is watching if the file change and reconfigure yanlog\n\nExample _app.js_:\n\n```js\nvar log = require('yanlog')('http')\n  , http = require('http')\n  , name = 'My App';\n\n// fake app\n\nlog.info('booting %s', name);\n\nhttp.createServer(function(req, res){\n  log.info(req.method + ' ' + req.url);\n  res.end('hello\\n');\n}).listen(3000, function(){\n  log.error('listening');\n});\n\n// fake worker of some kind\n\nrequire('./worker');\n```\n\nExample _worker.js_:\n\n```js\nvar log = require('yanlog')('worker');\n\nsetInterval(function(){\n  log.debug('doing some work');\n}, 1000);\n```\n\nExample _yanlog.js_:\n\n```js\nmodule.exports = {\n    \"options\": {\n        \"enableWatch\": true\n    },\n    \"configuration\": {\n        \"appender\": {\n            \"name\": \"console\",\n            \"transports\": [{\n                \"module\": \"Console\",\n                \"options\": {\n                    \"colorize\": true,\n                    \"timestamp\": true\n                }\n            }]\n        },\n        \"logger\": [{\n            \"name\": \"http\",\n            \"level\": \"warn\",\n            \"appender-ref\": \"console\"\n        }],\n        \"root\": {\n            \"level\": \"info\",\n            \"appender-ref\": \"console\"\n        }\n    }\n}\n```\n\n# yanlog.js structure\n## Options - Optional\n* `enableWatch` : enable watching file - default: true\n\n## Configuration\n### appender (array or object) - Required\nAppender defined all winston logger of your application.\n\n##### appender object:\n* `name`: name of appender - **Required**\n* `transports`: list of transports (or object) of appender - **Required**\n - `module`: name of module. yanlog tests \n if module exists in winston.transport else it will be imported. \n [list of available transport](https://github.com/flatiron/winston#working-with-transports) - **Required**\n - `submodule`: submodule (example: \"MongoDB\" for [mongodb-transport](https://github.com/flatiron/winston#mongodb-transport)) - **Optional**\n - `options`: options of module - **Optional**\n\n\n### logger (array or object)\nLogger defined all active loggers\n\n##### logger object:\n* `name`: namespace. The * character may be used as a wildcard. Suppose for example your library has debuggers named \"connect:bodyParser\", \"connect:compress\", \"connect:session\", instead of listing all three with different logger, you may simply do `connect:*` - **Required**\n* `level`: level of logger - **Optionnal** (Default: info)\n* `appender-ref`: reference to appender - **Required**\n\n### root - Optional\nDefault logger if no logger matches the current namespace\n\n##### root object:\n* `level` : level of logger - **Optionnal** (Default: info)\n* `appender-ref`: reference to appender - **Required**\n\n##### default root\n\n```js\nfunction getDefaultRootLogger() {\n    return logger = new(winston.Logger)({\n        transports: [\n            new(winston.transports.Console)({\n                level: 'info',\n                timestamp: true,\n                colorize: true\n            }),\n        ]\n    });\n}\n```\n\n## roadmap\n- add compatibility with yaml and .properties\n- config file testing in order to generate error logs\n\n## Change log\n[here](CHANGELOG.md)\n\n## Authors\n\n - [David Touzet](https://github.com/eyolas)\n\n## License\n\nThe [MIT](LICENCE) License\n\n[npm-image]: https://img.shields.io/npm/v/yanlog.svg?style=flat-square\n[npm-url]: https://github.com/eyolas/yanlog\n[gemnasium-image]: http://img.shields.io/gemnasium/eyolas/yanlog.svg?style=flat-square\n[gemnasium-url]: https://gemnasium.com/eyolas/yanlog","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feyolas%2Fyanlog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feyolas%2Fyanlog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feyolas%2Fyanlog/lists"}