{"id":17966230,"url":"https://github.com/darekf77/ng2-logger","last_synced_at":"2025-04-04T13:13:29.695Z","repository":{"id":49763374,"uuid":"60331925","full_name":"darekf77/ng2-logger","owner":"darekf77","description":"Isomorphic logger for Browser and NodeJS, ( typescript / javascript ) apps","archived":false,"fork":false,"pushed_at":"2024-10-03T07:42:13.000Z","size":8783,"stargazers_count":61,"open_issues_count":6,"forks_count":17,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-29T14:23:56.430Z","etag":null,"topics":["browser","isomorphic","logger","nodejs-library","ready-for-angular7","ready-for-react","ready-for-vue","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/darekf77.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-06-03T08:33:33.000Z","updated_at":"2024-10-03T07:42:17.000Z","dependencies_parsed_at":"2023-02-08T18:16:00.651Z","dependency_job_id":"684f6cc0-dcf3-44af-a762-4005dbb24e17","html_url":"https://github.com/darekf77/ng2-logger","commit_stats":{"total_commits":655,"total_committers":14,"mean_commits":"46.785714285714285","dds":0.4854961832061069,"last_synced_commit":"203f2198a7ab383ce5da7e0c3ab898440f4e647f"},"previous_names":[],"tags_count":228,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darekf77%2Fng2-logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darekf77%2Fng2-logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darekf77%2Fng2-logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darekf77%2Fng2-logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/darekf77","download_url":"https://codeload.github.com/darekf77/ng2-logger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247182420,"owners_count":20897381,"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":["browser","isomorphic","logger","nodejs-library","ready-for-angular7","ready-for-react","ready-for-vue","typescript"],"created_at":"2024-10-29T13:08:34.301Z","updated_at":"2025-04-04T13:13:29.662Z","avatar_url":"https://github.com/darekf77.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## taon-logger (ng2-logger) ##\n\n- Part of [taon.io](https://github.com/darekf77/taon)\n- Isomorphic Logger for TypeScript and JavaScript apps.\n- Purpose:\n  + usefull/elegant backend/frontend logger\n\nYou can use this logger in your apps with **any**\nTS/JS framework.\n \nSee what is going on in your app!\n\nNow chrome console logs are full of colors!\n\n![Modules marked](screen.png)\n\nSee nice server logs:\n\n![Modules marked](server.png)\n\n\nTo install package run:\n```\nnpm install ng2-logger --save\n```  \n\nFirst import proper version for your environment:\n\n  \n\nNodejs server (or any taon's lib/app):\n\n  \n\n```ts\n\nimport { Log, Level } from  'ng2-logger'\n\n```\n\nor Browser:\n\n  \n\n```ts\n\nimport { Log, Level } from  'ng2-logger/browser'  // new javascript module: es2015 + esnext + angular ivy support\n\n```\n\n  \n\nSimple use:\n\n  \n\nIn your file with log:\n\n```ts\n\nconst  log  =  Log.create('books');\n\n```\n\nor if you wanna just log errors and warnings :\n\n```ts\n\nconst  log  =  Log.create('books', Level.ERROR, Level.WARN);\n\n```\n\n'books' is current class or anything inside *.ts/*.js file.\n\n  \n\nYou can also assign static color to specific module in application (browser for now only):\n\n```ts\n\nlog.color  =  'red';\n\n```\n\nAfter inited **log** you are able to start debugging:\n\n```ts\n\nlog.d('object',obj) // console.log\n\nlog.er('object',obj) // console.error\n\nlog.i('object',obj) // console.info\n\nlog.w('object',obj) // console.warn\n\n```\n\nor\n\n```ts\n\nlog.debug('object',obj) // console.log\n\nlog.error('object',obj) // console.error\n\nlog.info('object',obj) // console.info\n\nlog.warn('object',obj) // console.warn\n\n```\n\n  \n  \n\n**Production mode**\n\n-------------------\n\n  \n\nYou will not see anyting in prduction mode:\n\n  \n\n// enable production mode in your app\n\n...\n\nLog.setProductionMode();\n\n...\n\n// your app code with console and ng2-logger logs\n\n  \n  \n\nIt is important to set production mode before any log messages are executed.\n\nThis will ensure that log messages that should not be seen are leaked out.\n\n  \n  \n\n**Selective debug - global settings**\n\n-------------------\n\n  \n\nOptional specify what you wanna see in yours debug console.\n\nThis settings will override settings from files.\n\n  \n\n```ts\n\nLog.setProductionMode();\n\nLog.onlyModules('src:books', 'src:records', 'src:page:login');\n\nLog.onlyLevel(Level.ERROR,Level.INFO);\n\n```\n\n  \n\n**Specifying `onlyModules` as regular expression(s)**\n\n-------------------\n\n  \n\nIn the above example you'll notice `module:books` and `module:records` were specified.\n\nyou might be using such syntax for namespace hierarchy etc. You may also pass in one or more regular\n\nexpression string(s) to the `onlyModule` function to specify a selection of modules you wish\n\nto show, for instances those whose name begins with `src`:\n\n  \n\n```ts\n\n  \n\nLog.onlyModules( new  RegEx('^.src') );\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarekf77%2Fng2-logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdarekf77%2Fng2-logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarekf77%2Fng2-logger/lists"}