{"id":19146743,"url":"https://github.com/lcluber/mouette.js","last_synced_at":"2026-04-18T15:39:28.303Z","repository":{"id":57126489,"uuid":"115253129","full_name":"LCluber/Mouette.js","owner":"LCluber","description":"Logger for javascript apps","archived":false,"fork":false,"pushed_at":"2021-05-22T16:46:09.000Z","size":2258,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-03T16:49:57.970Z","etag":null,"topics":["javascript","logger","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/LCluber.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-24T09:34:29.000Z","updated_at":"2022-04-17T14:17:03.000Z","dependencies_parsed_at":"2022-08-31T11:41:36.804Z","dependency_job_id":null,"html_url":"https://github.com/LCluber/Mouette.js","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LCluber%2FMouette.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LCluber%2FMouette.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LCluber%2FMouette.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LCluber%2FMouette.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LCluber","download_url":"https://codeload.github.com/LCluber/Mouette.js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240229976,"owners_count":19768597,"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":["javascript","logger","typescript"],"created_at":"2024-11-09T07:47:53.585Z","updated_at":"2025-10-03T12:41:14.123Z","avatar_url":"https://github.com/LCluber.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Synopsis\r\n\r\n**Mouette.js** is a lightweight logger written in Typescript.\r\n\r\n## Motivation\r\n\r\nThe purpose of this library is to provide a simple and easy way to log infos throughout your code.\r\n\r\n## Installation\r\n\r\n### NPM\r\n\r\n```bash\r\n$ npm install @lcluber/mouettejs\r\n```\r\n\r\n### Yarn\r\n\r\n```bash\r\n$ yarn add @lcluber/mouettejs\r\n```\r\n\r\n## Usage\r\n\r\n### ES6\r\n\r\n```javascript\r\nimport { Logger, Group } from \"@lcluber/mouettejs\";\r\n\r\n// some variables to log\r\nvar string = 'test';\r\nvar number = 2345;\r\nvar array  = [1,2,3,4];\r\nvar object = {\r\n  string: 'test',\r\n  number: 2345,\r\n  array: [1,2,3,4],\r\n  object: {yo: 'yo', ye: 'ye'}\r\n};\r\n\r\nvar newLogsGroup = Logger.addGroup(\"newLogsGroup\");\r\n\r\nnewLogsGroup.setLevel(\"info\");\r\nnewLogsGroup.displayConsole(true);\r\n\r\nnewLogsGroup.info(string);\r\nnewLogsGroup.trace(number);\r\nnewLogsGroup.warn(array);\r\nnewLogsGroup.error(object);\r\n\r\nnewLogsGroup.time(\"timing log\");\r\nfor (i = 0; i \u003c 100000; i++) {\r\n  // some code\r\n}\r\nnewLogsGroup.time(\"timing log\");\r\n\r\nvar logs = Logger.getLogs();\r\n\r\nconsole.log('logs', logs);\r\n\r\nvar sendLogs = Logger.sendLogs('http://httpbin.org/post');\r\nsendLogs.then((responseData) =\u003e {\r\n  console.log(responseData); //status response \r\n});\r\n```\r\n\r\n### IIFE\r\n\r\n```html\r\n\u003cscript src=\"node-modules/@lcluber/mouettejs/dist/mouette.iife.min.js\"\u003e\u003c/script\u003e\r\n```\r\n\r\n```javascript\r\n\r\n// some variables to log\r\nvar string = 'test';\r\nvar number = 2345;\r\nvar array  = [1,2,3,4];\r\nvar object = {\r\n  string: 'test',\r\n  number: 2345,\r\n  array: [1,2,3,4],\r\n  object: {yo: 'yo', ye: 'ye'}\r\n};\r\n\r\nvar newLogsGroup = Mouette.Logger.addGroup(\"newLogsGroup\");\r\n\r\nnewLogsGroup.setLevel(\"info\");\r\nnewLogsGroup.displayConsole(true);\r\n\r\nnewLogsGroup.info(string);\r\nnewLogsGroup.trace(number);\r\nnewLogsGroup.warn(array);\r\nnewLogsGroup.error(object);\r\n\r\nnewLogsGroup.time(\"timing log\");\r\nfor (i = 0; i \u003c 100000; i++) {\r\n  // some code\r\n}\r\nnewLogsGroup.time(\"timing log\");\r\n\r\nvar logs = Mouette.Logger.getLogs();\r\n\r\nconsole.log('logs', logs);\r\n\r\nvar sendLogs = Mouette.Logger.sendLogs('http://httpbin.org/post');\r\nsendLogs.then((responseData) =\u003e {\r\n  console.log(responseData); //status response \r\n});\r\n\r\n```\r\n\r\n## API Reference\r\n\r\n```javascript\r\ntype LevelName = \"info\" | \"time\" | \"trace\" | \"warn\" | \"error\" | \"off\";\r\ntype LogContent = string | number | any[] | Object;\r\n\r\nstatic Logger.setLevel(name: LevelName): LevelName {} // set the minimum level at which logs can be stored and displayed into console. Note that this setting will propagate to every group. You can set a different level for a group AFTER setting the level for the entire logger.\r\nstatic Logger.getLevel(): LevelName {} // get the general level of the logger. Note that groups can have a different level if changed afterwards at group level\r\nstatic Logger.displayConsole(value: boolean): boolean {} // set wether or not to display logs into console at logger level. Note that this setting will propagate to every group. This option can be changed individually for each group if changed afterwards at group level\r\nstatic Logger.addGroup(name: string): Group {} // create a new group of logs\r\nstatic Logger.getLogs(): Log[] {} // get all the logs in 1 array\r\nstatic Logger.sendLogs(url: string, headers: Headers): Promise\u003cresponse\u003e {} // sends all the logs to given backend API ans reset logs if success.\r\nstatic Logger.resetLogs(): void {} // Delete every logs of every group \r\n\r\nGroup.setLevel(name: LevelName): levelName {} // set the minimum level at which logs of this group can be stored and displayed into console\r\nGroup.getLevel(): LevelName {} // get the level at which logs of this group can be displayed\r\nGroup.displayConsole(value: boolean): boolean {} // set wether or not to display logs into console\r\nGroup.setMaxLength(length: number): number {} // set the maximum quantity of logs stored by this group\r\nGroup.getMaxLength(): number {} // get the maximum quantity of logs stored by this group\r\n\r\nGroup.info(log: LogContent): void {} // create an info log\r\nGroup.time(key: string | number): void {} // create a time log. Use the same method to start or stop the timer. Using the same key, first call will start it, second call will stop it and return the elapsed time between the two.\r\nGroup.trace(log: LogContent): void {} // create a trace log\r\nGroup.warn(log: LogContent): void {} // create a warn log\r\nGroup.error(log: LogContent): void {} // create an error log\r\n\r\nLEVELS: Levels = {\r\n  info:   { id:  1, name: \"info\",  color: \"#28a745\" },\r\n  time:   { id:  2, name: \"time\",  color: \"#28a745\" },\r\n  trace:  { id:  3, name: \"trace\", color: \"#17a2b8\" },\r\n  warn:   { id:  4, name: \"warn\",  color: \"#ffc107\" },\r\n  error:  { id:  5, name: \"error\", color: \"#dc3545\" },\r\n  off:    { id: 99, name: \"off\",   color: null }\r\n};\r\n\r\n```\r\n\r\n## Tests\r\n\r\nNo tests to run yet\r\n\r\n## Contributors\r\n\r\nThere is still a lot of work to do on this project and I would be glad to get all the help you can provide.\r\nTo contribute you can clone the project on **[GitHub](https://github.com/LCluber/Mouette.js)** and see **NOTICE.md** for detailed installation walkthrough of the project.\r\n\r\n## License\r\n\r\nMIT License\r\n\r\nCopyright (c) 2017 Ludovic CLUBER\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy\r\nof this software and associated documentation files (the \"Software\"), to deal\r\nin the Software without restriction, including without limitation the rights\r\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\ncopies of the Software, and to permit persons to whom the Software is\r\nfurnished to do so, subject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be included in all\r\ncopies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\nSOFTWARE.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flcluber%2Fmouette.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flcluber%2Fmouette.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flcluber%2Fmouette.js/lists"}