{"id":18653451,"url":"https://github.com/fullstackacademy/nice-sequelize-logger","last_synced_at":"2025-10-13T07:32:06.495Z","repository":{"id":46323188,"uuid":"194151033","full_name":"FullstackAcademy/nice-sequelize-logger","owner":"FullstackAcademy","description":"A nice logger for sequelize.","archived":false,"fork":false,"pushed_at":"2023-07-12T00:12:18.000Z","size":59,"stargazers_count":1,"open_issues_count":8,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-05T09:43:09.364Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FullstackAcademy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-06-27T19:20:09.000Z","updated_at":"2023-12-22T21:18:40.000Z","dependencies_parsed_at":"2022-09-01T14:41:44.935Z","dependency_job_id":"c8e0ca9e-be7b-4bc1-9b8c-669d41d3ae0c","html_url":"https://github.com/FullstackAcademy/nice-sequelize-logger","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/FullstackAcademy/nice-sequelize-logger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FullstackAcademy%2Fnice-sequelize-logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FullstackAcademy%2Fnice-sequelize-logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FullstackAcademy%2Fnice-sequelize-logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FullstackAcademy%2Fnice-sequelize-logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FullstackAcademy","download_url":"https://codeload.github.com/FullstackAcademy/nice-sequelize-logger/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FullstackAcademy%2Fnice-sequelize-logger/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279014119,"owners_count":26085463,"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","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-11-07T07:11:49.400Z","updated_at":"2025-10-13T07:32:06.472Z","avatar_url":"https://github.com/FullstackAcademy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nice-sequelize-logger\n\n## Install\n\nInstall with `npm`:\n\n```bash\nnpm i github:FullstackAcademy/nice-sequelize-logger\n```\n\nThen, to add the logger to your app, add code that looks something like this wherever you initialize your `new Sequelize` instance.\n\n```js\nconst Sequelize = require(\"sequelize\");\nconst { createNiceSequelizeLoggerConfig } = require(\"nice-sequelize-logger\");\n\nconst niceLoggerConfig = createNiceSequelizeLoggerConfig();\n\nconst db = new Sequelize(\"postgres://localhost:5432/database-name\", {\n  ...niceLoggerConfig,\n});\n\nmodule.exports = db;\n```\n\n## Actually Getting The Log Messages To Show Up\n\nThe logger checks an environment variable is set before logging: `if (process.env.LOG_SQL_STATEMENTS === \"true\")`.\n\nThis can be set at startup time:\n\n```bash\nLOG_SQL_STATEMENTS=true node my-server.js\n```\n\nIt can also be used to hide certain log messages. Syncing a database spits out a lot of sql even if nothing actually changes. It's a common pattern to call sync when an application boots, so it can be nice to hide that output.\n\n\n```js\napp.listen(3000, async function() {\n  console.log(`The server is listening closely on port ${PORT}`);\n  try {\n    process.env.LOG_SQL_STATEMENTS = false;\n    await db.sync();\n    process.env.LOG_SQL_STATEMENTS = true;\n    console.log(\"Synchronized the database.\");\n  }\n  catch (error) {\n    console.error(\"Error while synchronizing the database.\");\n    console.error(error);\n  }\n});\n```\n\n## Update\nIn order to update we need to update the `package-lock.json` file to point to the latest commit on github.\n\nnpm will resolve this for us if we ask it to re-install.\n\n```bash\nnpm i github:FullstackAcademy/nice-sequelize-logger\ngit add package.json\ngit add package-lock.json\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffullstackacademy%2Fnice-sequelize-logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffullstackacademy%2Fnice-sequelize-logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffullstackacademy%2Fnice-sequelize-logger/lists"}