{"id":15612293,"url":"https://github.com/euberdeveloper/euberlog","last_synced_at":"2025-04-28T16:17:08.674Z","repository":{"id":57231038,"uuid":"322886461","full_name":"euberdeveloper/euberlog","owner":"euberdeveloper","description":"A beautiful nodejs logger","archived":false,"fork":false,"pushed_at":"2024-08-25T18:45:42.000Z","size":1572,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-28T16:17:05.445Z","etag":null,"topics":["logger","mocha","npm","typescript"],"latest_commit_sha":null,"homepage":"https://euberlog.euber.dev","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/euberdeveloper.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-19T16:10:40.000Z","updated_at":"2024-08-25T18:45:45.000Z","dependencies_parsed_at":"2024-06-19T02:58:23.165Z","dependency_job_id":"ea9afd32-5f4e-44df-9312-a5ae3db700d2","html_url":"https://github.com/euberdeveloper/euberlog","commit_stats":{"total_commits":156,"total_committers":3,"mean_commits":52.0,"dds":"0.13461538461538458","last_synced_commit":"c9cd4d4ecb32c2e6128ef008444d470f562fa87f"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/euberdeveloper%2Feuberlog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/euberdeveloper%2Feuberlog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/euberdeveloper%2Feuberlog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/euberdeveloper%2Feuberlog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/euberdeveloper","download_url":"https://codeload.github.com/euberdeveloper/euberlog/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251342725,"owners_count":21574245,"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":["logger","mocha","npm","typescript"],"created_at":"2024-10-03T06:41:31.582Z","updated_at":"2025-04-28T16:17:08.656Z","avatar_url":"https://github.com/euberdeveloper.png","language":"TypeScript","readme":"![Lint](https://github.com/euberdeveloper/euberlog/workflows/Lint/badge.svg)\n![Build](https://github.com/euberdeveloper/euberlog/workflows/Build/badge.svg)\n![Test](https://github.com/euberdeveloper/euberlog/workflows/Test/badge.svg)\n[![Coverage Status](https://coveralls.io/repos/github/euberdeveloper/euberlog/badge.svg?branch=main)](https://coveralls.io/github/euberdeveloper/euberlog?branch=main)\n[![codecov](https://codecov.io/gh/euberdeveloper/euberlog/branch/main/graph/badge.svg?token=4YW49XC338)](https://codecov.io/gh/euberdeveloper/euberlog)\n[![Known Vulnerabilities](https://snyk.io/test/github/euberdeveloper/euberlog/badge.svg?targetFile=package.json)](https://snyk.io/test/github/euberdeveloper/euberlog?targetFile=package.json)\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n[![License](https://img.shields.io/npm/l/euberlog.svg)](https://github.com/euberdeveloper/euberlog/blob/master/LICENSE)\n[![GitHub issues](https://img.shields.io/github/issues/euberdeveloper/euberlog.svg)](https://github.com/euberdeveloper/euberlog/issues)\n[![GitHub stars](https://img.shields.io/github/stars/euberdeveloper/euberlog.svg)](https://github.com/euberdeveloper/euberlog/stargazers)\n![npm](https://img.shields.io/npm/v/euberlog.svg)\n[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n[![Types](https://img.shields.io/npm/types/euberlog.svg)](https://www.npmjs.com/package/euberlog)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/898fd5ca5774fb92d9c8/test_coverage)](https://codeclimate.com/github/euberdeveloper/euberlog/test_coverage)\n\n# euberlog\nA beautiful nodejs logger.\n\n## Install\n\nTo install euberlog, run:\n\n```bash\n$ npm install euberlog\n```\n\n## Usage\n\n## Simple\n\n```js\nconst { Logger } = require('euberlog');\nconst logger = new Logger();\n\nlogger.info('Informazione');\nlogger.success('Successo!!!');\nlogger.debug('Debug');\nlogger.warning('Warning!!');\nlogger.error('Errore');\n\nlogger.info('My car is:', { constructor: 'Toyota', model: 'Yaris', year: 2004 });\n```\n\n![Simple example](https://github.com/euberdeveloper/euberlog/raw/main/docs/assets/simple.png)\n\n## Default instance\n\nThere is a default export consisting in an instance of `Logger` with default options\n\n```js\nconst logger = require('euberlog').default;\n\nlogger.info('Informazione');\nlogger.success('Successo!!!');\nlogger.debug('Debug');\nlogger.warning('Warning!!');\nlogger.error('Errore');\n\nlogger.info('My car is:', { constructor: 'Toyota', model: 'Yaris', year: 2004 });\n```\n\n![Simple example](https://github.com/euberdeveloper/euberlog/raw/main/docs/assets/simple.png)\n\n\n## Br and hr\n\n```js\nconst { Logger } = require('euberlog');\nconst logger = new Logger();\n\n// Prints one line of '-'\nlogger.hr();\n\n// Prints two empty lines\nlogger.br(2);\n\nlogger.info('My name is Eugenio');\n\n// Prints two empty lines\nlogger.br(2);\n\n// Prints five lines of red '*'\nlogger.hr(5, 'red', '*');\n```\n\n![Simple example](https://github.com/euberdeveloper/euberlog/raw/main/docs/assets/br_and_hr.png)\n\n## With scope\n\n```js\nconst { Logger } = require('euberlog');\nconst logger = new Logger('MAIN');\n\n// Adds {MAIN} before the message\nlogger.info('Informazione');\nlogger.success('Successo!!!');\nlogger.error('The error is:', new Error('Errore'));\n```\n![Simple example](https://github.com/euberdeveloper/euberlog/raw/main/docs/assets/with_scope.png)\n\n## With options\n\n```js\nconst { Logger } = require('euberlog');\nconst logger = new Logger({\n    scope: 'MYSCOPE',\n    debug: false, // Hides the debug logs\n    palette: { // Overrides the default colour palette\n        primary: {\n            info: 'orange',\n            success: '(146,133,255)'\n        },\n        secondary: {\n            info: '#ffd485',\n            success: 'blue'\n        }\n    }\n});\n\nlogger.info('Informazione');\nlogger.success('Successo!!!');\nlogger.debug('This is not shown');\n```\n\n![Simple example](https://github.com/euberdeveloper/euberlog/raw/main/docs/assets/with_options.png)\n\n## API\n\nThe documentation site is: [euberlog documentation](https://euberlog.euber.dev)\n\nThe documentation for development site is: [euberlog dev documentation](https://euberlog-dev.euber.dev)\n\n### Logger\n\nThe logger class, its instances will be the euber loggers.\n\n**Syntax:**\n\n`const logger = new Logger(options);`\n\n**Options:**\n\nThe options parameter is a `string` or a `Options` object. If it is a string, it like passing an `Options` object with only the property `scope` with that string as value.\n\n**Options parameters:**\n\n* __scope__: Optional. A `string` representing the scope of the logger. It is prepended between `{}` before each message. If it is `null` the scope will not be printed.\n* __debug__: Optional. If `true`, the debug messages will be printed.\n* __palette__: Optional. An `object` of type `Palette` representing the colours used by the logger.\n\n**Palette parameters:**\n\n* __primary__: Optional. An `object` of `PaletteDefinitions` type that defines the colours for the primary part of a message, namely the `[TAG]` and an eventual `{SCOPE}`.\n* __secondary__: Optional. An `object` of `PaletteDefinitions` type that defines the colours for the secondary part of a message, namely the message passed to the logger function.\n\n**PaletteDefinitions:**\n\n* __info__: The colour for the info logs. Note: the colour can be a valid `chalk` colour (such as `'white'`), an hex colour (such as `'#FFFFFF'`), an RGB colour (such as `'(255,255,255)'`) or a css keyword (such as `'orange'`)\n* __success__: The colour for the success logs. Note: the colour can be a valid `chalk` colour (such as `'white'`), an hex colour (such as `'#FFFFFF'`), an RGB colour (such as `'(255,255,255)'`) or a css keyword (such as `'orange'`)\n* __debug__: The colour for the debug logs. Note: the colour can be a valid `chalk` colour (such as `'white'`), an hex colour (such as `'#FFFFFF'`), an RGB colour (such as `'(255,255,255)'`) or a css keyword (such as `'orange'`)\n* __warning__: The colour for the warning logs. Note: the colour can be a valid `chalk` colour (such as `'white'`), an hex colour (such as `'#FFFFFF'`), an RGB colour (such as `'(255,255,255)'`) or a css keyword (such as `'orange'`)\n* __error__: The colour for the error logs. Note: the colour can be a valid `chalk` colour (such as `'white'`), an hex colour (such as `'#FFFFFF'`), an RGB colour (such as `'(255,255,255)'`) or a css keyword (such as `'orange'`)\n\nNote: the __default_options__ are:\n\n```js\nconst DEFAULT_OPTIONS = {\n    palette: {\n        primary: {\n            info: 'blue',\n            success: 'green',\n            debug: 'gray',\n            warning: 'yellow',\n            error: 'red'\n        },\n        secondary: {\n            info: '#81A2BE',\n            success: '#B5BD68',\n            debug: '#C5C8C6',\n            warning: '#F0C674',\n            error: '#CC6666'\n        }\n    },\n    debug: true,\n    scope: null\n};\n```\n\n**Methods:**\n\n* __info(message: string, object?: any): void__: Logs an info message. The format is `[INFO] |{SCOPE}| message |object|`, where `|word|` is optional.\n* __success(message: string, object?: any): void__: Logs an success message. The format is `[SUCCESS] |{SCOPE}| message |object|`, where `|word|` is optional.\n* __debug(message: string, object?: any): void__: Logs an debug message. The format is `[DEBUG] |{SCOPE}| message |object|`, where `|word|` is optional.\n* __warning(message: string, object?: any): void__: Logs an warning message. The format is `[WARNING] |{SCOPE}| message |object|`, where `|word|` is optional.\n* __error(message: string, object?: any): void__: Logs an error message. The format is `[ERROR] |{SCOPE}| message |object|`, where `|word|` is optional.\n* __br(n?: number): void__: Logs `n` empty lines. The default value of `n` is `1`.\n* __hr(n?: number, color?: string, symbol: string): void__: Logs `n` hr lines, coloured with `color` and constituted by `symbol` characters. THe default value of `n` is `1`, the default colour is `'white'` and the default symbol is `'-'`.\n* __setOptions(options?: Options | string): void__: It changes the options of the logger instance. It is almost as using the class constructor, with the difference that a new instance will not be created.\n\n### Default instance\n\nThere is a default export consisting in an instance of `Logger` with default options\n\n## Project structure\n\n[//]: # (dree - BEGIN)\nMade with [dree](https://github.com/marketplace/actions/ga-dree)\n\n\n```\neuberlog\n ├── .eslintignore\n ├── .eslintrc.cjs\n ├─\u003e .github\n │   └─\u003e workflows\n │       ├── build.yml\n │       ├── dree.yml\n │       ├── lint.yml\n │       └── test.yml\n ├── .gitignore\n ├── .prettierrc.cjs\n ├── .release-it.json\n ├── CHANGELOG.md\n ├── LICENSE\n ├── README.md\n ├── babel.config.cjs\n ├── build.mjs\n ├─\u003e docs\n │   ├── .gitignore\n │   ├─\u003e assets\n │   │   ├── br_and_hr.png\n │   │   ├── simple.png\n │   │   ├── with_options.png\n │   │   └── with_scope.png\n │   └─\u003e tree\n │       └── dree.config.json\n ├── package.json\n ├── pnpm-lock.yaml\n ├─\u003e source\n │   ├── index.ts\n │   ├── tsconfig.json\n │   ├─\u003e types\n │   │   ├─\u003e deep-partial\n │   │   │   └── index.ts\n │   │   ├── index.ts\n │   │   ├─\u003e options\n │   │   │   └── index.ts\n │   │   └─\u003e palette\n │   │       └── index.ts\n │   └─\u003e utils\n │       ├── colour.ts\n │       ├── logger.ts\n │       └── options.ts\n ├─\u003e test\n │   ├── .eslintrc.cjs\n │   ├─\u003e suites\n │   │   ├─\u003e colour\n │   │   │   └── colour.test.ts\n │   │   ├─\u003e handleOptions\n │   │   │   └── handleOptions.test.ts\n │   │   └─\u003e logger\n │   │       ├─\u003e constructor\n │   │       │   └── constructor.test.ts\n │   │       ├─\u003e defaultInstance\n │   │       │   └── defaultInstance.test.ts\n │   │       ├─\u003e logs\n │   │       │   ├─\u003e noDebug\n │   │       │   │   ├─\u003e debug\n │   │       │   │   │   └── debug.test.ts\n │   │       │   │   ├─\u003e error\n │   │       │   │   │   └── error.test.ts\n │   │       │   │   ├─\u003e info\n │   │       │   │   │   └── info.test.ts\n │   │       │   │   ├─\u003e success\n │   │       │   │   │   └── success.test.ts\n │   │       │   │   └─\u003e warning\n │   │       │   │       └── warning.test.ts\n │   │       │   ├─\u003e scoped\n │   │       │   │   ├─\u003e debug\n │   │       │   │   │   └── debug.test.ts\n │   │       │   │   ├─\u003e error\n │   │       │   │   │   └── error.test.ts\n │   │       │   │   ├─\u003e info\n │   │       │   │   │   └── info.test.ts\n │   │       │   │   ├─\u003e success\n │   │       │   │   │   └── success.test.ts\n │   │       │   │   └─\u003e warning\n │   │       │   │       └── warning.test.ts\n │   │       │   ├─\u003e simple\n │   │       │   │   ├─\u003e debug\n │   │       │   │   │   └── debug.test.ts\n │   │       │   │   ├─\u003e error\n │   │       │   │   │   └── error.test.ts\n │   │       │   │   ├─\u003e info\n │   │       │   │   │   └── info.test.ts\n │   │       │   │   ├─\u003e success\n │   │       │   │   │   └── success.test.ts\n │   │       │   │   └─\u003e warning\n │   │       │   │       └── warning.test.ts\n │   │       │   └─\u003e specials\n │   │       │       └── specials.test.ts\n │   │       └─\u003e setOptions\n │   │           └── setOptions.test.ts\n │   └─\u003e utils\n │       └── getDefaultOptions.ts\n ├── tsconfig.json\n ├── tsconfig.test.json\n ├── typedoc.cjs\n ├── typedoc.dev.cjs\n └── vitest.config.ts\n```\n[//]: # (dree - END)\n\n## Development\n\nTo build the module make sure you have the dev dependencies installed.\n\nThe project is written in `Typescript`, bundled with `EsBuild` and linted with `ESLint`.\n\n### Lint\n\nIn order to lint the code:\n\n```bash\n$ npm run lint\n```\n\nIn order to lint and fix the code:\n\n```bash\n$ npm run lint:fix\n```\n\nThere are also the `:source` and `:test` suffix after `lint` in order to lint only the source code or the test code.\n\n### Transpile\n\nTo transpile both the source and the test code:\n\n```bash\n$ npm run transpile:all\n```\n\nThe `source` and the `test` folders will be transpiled in the `dist` folder. Also the `type declarations` will be generated.\n\n\nTo transpile only the source code:\n\n```bash\n$ npm run transpile:source\n```\n\nThe `source` folder will be transpiled in the `dist` folder. Also the `type declarations` will be generated.\n\n### Test\n\nAfter having transpiled the code, run:\n\n```bash\n$ npm test\n```\n\nin order to run the tests with `vitest run`.\n\nIf a coverage report is to be generated, run:\n\n```bash\n$ npm run cover:generate\n```\n\n### Bundle\n\nThe bundler bundles both a `commonjs` and an `esm` version of the module. Also a `dts` file is generated, via `dts-bundle-generator`.\n\n```bash\n$ npm run bundle\n```\n\nThe `source` folder will be compiled in the `bundled` folder. It will contain the bundled `index.js`, `index.esm.js` and `index.d.ts` files.\n\nNote: since `chalk` is only an esm, for the commonjs version it is bundled within the module itself.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feuberdeveloper%2Feuberlog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feuberdeveloper%2Feuberlog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feuberdeveloper%2Feuberlog/lists"}