{"id":19697180,"url":"https://github.com/plopix/js-console-wrapper","last_synced_at":"2025-04-29T11:32:25.054Z","repository":{"id":57137263,"uuid":"251551313","full_name":"Plopix/js-console-wrapper","owner":"Plopix","description":"A beautiful Console Log wrapper","archived":false,"fork":false,"pushed_at":"2020-04-01T01:48:02.000Z","size":21,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-19T10:30:46.358Z","etag":null,"topics":["console","developer-tools","javascript","logger","logging"],"latest_commit_sha":null,"homepage":null,"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/Plopix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["plopix"]}},"created_at":"2020-03-31T09:02:20.000Z","updated_at":"2022-09-03T17:07:06.000Z","dependencies_parsed_at":"2022-09-01T04:00:58.342Z","dependency_job_id":null,"html_url":"https://github.com/Plopix/js-console-wrapper","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/Plopix%2Fjs-console-wrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Plopix%2Fjs-console-wrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Plopix%2Fjs-console-wrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Plopix%2Fjs-console-wrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Plopix","download_url":"https://codeload.github.com/Plopix/js-console-wrapper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251494115,"owners_count":21598236,"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":["console","developer-tools","javascript","logger","logging"],"created_at":"2024-11-11T19:37:25.386Z","updated_at":"2025-04-29T11:32:24.307Z","avatar_url":"https://github.com/Plopix.png","language":"TypeScript","funding_links":["https://github.com/sponsors/plopix"],"categories":[],"sub_categories":[],"readme":"# Plopix - JS Console\n\nThis package is a wrapper of `console.log` that enables output depending on a Verbosity level.\nIt also brings color and manage compability.\n\nThe verbosity level helps to only display from a certain level. \n \n- you can set in the source code\n- you can override via LocalStorage using the key: `plopix.console.verbosity`\n\n\u003e In your console toolbar, run `localStorage.setItem(\"plopix.console.verbosity\",250)` for instance.\n\nPretty neat!\n\n## Installation\n\n### Vanilla JS Usage\n\nInject the library in your code:\n\n```html\n\u003cscript src=\"https://github.com/Plopix/js-console-wrapper/releases/download/v1.0.1/plopix-js-console.min.js\"\u003e\u003c/script\u003e\n```\n\nYou have now access to `PlopixConsole` globally.\n\n\n### Node\n\n- Use NPM `npm i @plopix/js-console -D`\n- Use Yarn `yarn add --dev @plopix/js-console`\n\nThen the asiest is to create your own `Console.js` file, and put:\n\n```javascript\nimport { Console } from '@plopix/js-console/dist/ts/Console';\n\nconst PlopixConsole = new Console();\nPlopixConsole.verbosity = 0;\nPlopixConsole.logOnLoad();\n\nexport default PlopixConsole;\n```\n\nAnd then import it in your project when you want\n\n```javascript\nimport Console from './path/to/Console';\n\nConsole.success(\"Console well installed!\");\n```\n\n## Usage\n\nJust use it!\n\n\u003e Have a look in the [example](tests/web/tests.js).\n\n\nIn addition to the method provided by the `LoggerInterface` you also have\n\n```typescript      \n    groupStart(title: string): void;\n    groupEnd(): void;\n    dir(data: any): void;\n    table(data: any): void;\n    clear(): void;\n    memory(): void;\n    trace(): void;\n```\n\n\u003e They won't display anything if the Browser does not support it.\n\n### On Load Console Logging\n\nIf you want to log things on the page load, you can use a specific HTML tag.\n\n```html\n\u003cspan style=\"display: none\" data-plopix-console data-verbosity=\"200\" data-context=\"[1,2,3,4]\"\u003eOh yeah %d %d\u003c/span\u003e\n``` \n\n\u003e Have a look in the [example](tests/web/tests.html).\n\n\n### Many Levels\n\n```typescript\nexport enum Level {\n    EMERGENCY = 600,\n    ALERT = 550,\n    CRITICAL = 500,\n    ERROR = 400,\n    WARNING = 300,\n    NOTICE = 250,\n    INFO = 200,\n    DEBUG = 100,\n    SUCCESS = 0\n}\n```\n\n\u003e Can be used with Level.* in TypeScript\n\n###  Many Method\n\n```typescript\nexport interface LoggerInterface {\n    // Logs with an arbitrary level.\n    log(level: Level, message: string, context?: any): void;\n\n    // System is unusable.\n    emergency(message: string, context?: any): void;\n\n    // Action must be taken immediately.\n    alert(message: string, context?: any): void;\n\n    // Critical conditions.\n    critical(message: string, context?: any): void;\n\n    // Runtime errors that do not require immediate action but should typically be logged and monitored.\n    error(message: string, context?: any): void;\n\n    //  Exceptional occurrences that are not errors.\n    warning(message: string, context?: any): void;\n\n    // Normal but significant events.\n    notice(message: string, context?: any): void;\n\n    // Interesting events.\n    info(message: string, context?: any): void;\n\n    //  Detailed debug information.\n    debug(message: string, context?: any): void;\n\n    //  When all is good\n    success(message: string, context?: any): void;\n}\n```\n\n\n## Licensing\n\nProject under the [MIT License (MIT)](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplopix%2Fjs-console-wrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplopix%2Fjs-console-wrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplopix%2Fjs-console-wrapper/lists"}