{"id":29555943,"url":"https://github.com/anoesj/google-calendar-logger","last_synced_at":"2026-05-18T11:06:56.703Z","repository":{"id":57252153,"uuid":"202883136","full_name":"Anoesj/google-calendar-logger","owner":"Anoesj","description":"Provides ways to log time to your Google Calendar","archived":false,"fork":false,"pushed_at":"2020-02-16T20:28:10.000Z","size":37,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-08-11T12:56:12.499Z","etag":null,"topics":["calendar","gcal","google","logger","nodejs","timelog"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Anoesj.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}},"created_at":"2019-08-17T13:16:37.000Z","updated_at":"2020-02-16T20:28:12.000Z","dependencies_parsed_at":"2022-09-04T23:10:45.661Z","dependency_job_id":null,"html_url":"https://github.com/Anoesj/google-calendar-logger","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Anoesj/google-calendar-logger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anoesj%2Fgoogle-calendar-logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anoesj%2Fgoogle-calendar-logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anoesj%2Fgoogle-calendar-logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anoesj%2Fgoogle-calendar-logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Anoesj","download_url":"https://codeload.github.com/Anoesj/google-calendar-logger/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anoesj%2Fgoogle-calendar-logger/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265736408,"owners_count":23819948,"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":["calendar","gcal","google","logger","nodejs","timelog"],"created_at":"2025-07-18T09:41:53.451Z","updated_at":"2026-05-18T11:06:51.666Z","avatar_url":"https://github.com/Anoesj.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Google Calendar Logger\n\n***Work in progress, package might not work properly at this time.***\n***Known problems: can't create token.***\n\n## Installation\n- `pnpm i google-calendar-logger -D`\n- or `npm i google-calendar-logger -D`\n- or `yarn add google-calendar-logger -D`\n\n## Usage\nTo start using the logger, you'll need to:\n1. generate a credentials.json at https://developers.google.com/calendar/quickstart/nodejs\n2. create an instance of the logger\n3. then, the first time, you'll be asked to visit a URL to generate a token.json\n\n## Creating an instance of the logger\nFor each calendar you want to log to, you'll need to create a new instance of Google Calendar Logger:\n```javascript\nconst GoogleCalendarLogger = require('./google-calendar-logger'),\n      path = require('path');\n\nconst logger = new GoogleCalendarLogger({\n  credentialsPath: path.resolve(process.cwd(), './gcl/credentials.json'),\n  tokenPath: path.resolve(process.cwd(), './gcl/token.json'),\n  calendar: 'Some calendar name',\n});\n```\n\n## How to actually log time?\nDepending on the project, you'll need a way to tell the logger to start logging time and end logging time. You can do this by using the `logger.logStart()` and `logger.logEnd()` methods. To let the logger know that you're still working, use the `logger.logActivity()` method.\n\n### Example: logging time with Browsersync\n```javascript\nconst bs = require('browser-sync').create();\n\n// Create GCL instance, like in the example above\n\n// Logging start\nbs.init({\n  server: 'src',\n  open: false,\n}, () =\u003e { logger.logStart(); });\n\n// Logging activity\nbs.watch('src/index.html').on('change', handleChange);\nbs.watch('src/**/*.js').on('change', handleChange);\n\nfunction handleChange (...args) {\n  bs.reload(...args);\n\n  const fileNames = args.map(file =\u003e path.posix.basename(file));\n  logger.logActivity('Changes in ' + fileNames.join(', '));\n}\n```\n\nThen, use something like `node-cleanup` to call `logger.logEnd()` when you're ending the Browsersync process. **Disclaimer**: I'm not entirely sure this is the correct way of using `node-cleanup`. I'm open to suggestions!\n\n```javascript\nconst nodeCleanup = require('node-cleanup');\n\n// Logging end\nnodeCleanup((exitCode, signal) =\u003e {\n  if (signal) {\n    // Stop Browsersync\n    bs.exit();\n\n    logger.logEnd().then(() =\u003e {\n      // calling process.exit() won't inform parent process of signal\n      process.kill(process.pid, signal);\n    });\n\n    // don't call cleanup handler again\n    nodeCleanup.uninstall();\n\n    // tell node-cleanup not to exit yet\n    return false;\n  }\n}, {\n  ctrl_C: '\\n^C\\n',\n});\n```\n\n## Optional\nSet `minutesUntilInactivity` to change how soon a log will be interrupted because of inactivity. By default, a log will be split on the next `logActivity()` or trimmed when calling `logEnd()` if there hasn't been any activity for 10 minutes or longer.\n\nSet `showLinks` to `true` to print URLs to the created/updated events in the CLI.\n\nYou can also override strings in the `strings` object to customize how events are called in your calendar. You can either enter a string or a function, where the only parameter is a string equal to the calendar name (this may change later on, because it's kind of pointless).\nStrings you can override are:\n```javascript\n{\n  activityStarted:              projectName =\u003e `Started working on ${projectName}`,\n  activityInProgress:           projectName =\u003e `Working on ${projectName}`,\n  activityConcluded:            projectName =\u003e `Worked on ${projectName}`,\n  activityLogged:               projectName =\u003e `Activity in ${projectName}`,\n  closedDueToInactivity:        projectName =\u003e `(closed due to inactivity)`,\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanoesj%2Fgoogle-calendar-logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanoesj%2Fgoogle-calendar-logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanoesj%2Fgoogle-calendar-logger/lists"}