{"id":20630702,"url":"https://github.com/sysgears/apollo-logger","last_synced_at":"2025-04-15T18:23:59.531Z","repository":{"id":48020505,"uuid":"91121998","full_name":"sysgears/apollo-logger","owner":"sysgears","description":"Apollo GraphQL Logger","archived":false,"fork":false,"pushed_at":"2021-08-10T22:50:57.000Z","size":137,"stargazers_count":19,"open_issues_count":4,"forks_count":2,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-03-04T17:48:57.018Z","etag":null,"topics":["apollo","graphql","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/sysgears.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":"2017-05-12T19:08:31.000Z","updated_at":"2021-11-19T20:51:30.000Z","dependencies_parsed_at":"2022-08-12T16:50:44.505Z","dependency_job_id":null,"html_url":"https://github.com/sysgears/apollo-logger","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysgears%2Fapollo-logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysgears%2Fapollo-logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysgears%2Fapollo-logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysgears%2Fapollo-logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sysgears","download_url":"https://codeload.github.com/sysgears/apollo-logger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249126987,"owners_count":21216901,"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":["apollo","graphql","logging"],"created_at":"2024-11-16T14:09:19.660Z","updated_at":"2025-04-15T18:23:59.510Z","avatar_url":"https://github.com/sysgears.png","language":"TypeScript","readme":"## Apollo GraphQL Logger\n\n[![npm version](https://badge.fury.io/js/apollo-logger.svg)](https://badge.fury.io/js/apollo-logger) \n[![Twitter Follow](https://img.shields.io/twitter/follow/sysgears.svg?style=social)](https://twitter.com/sysgears)\n\n## Installation\n\n```bash\nnpm install --save-dev apollo-logger\n```\n\n## Usage\n\nFor full logging you will need to attach Apollo Logger to:\n- Apollo Link\n- Apollo Express Server\n- And PubSub\n\n``` js\nimport { LoggingLink, wrapPubSub, formatResponse } from 'apollo-logger';\n\nconst logOptions = { logger: console.log };\n\nconst link = ApolloLink.from([\n  new LoggingLink(logOptions),\n  new HttpLink({uri: ...})\n);\n\n...\n\napp.use('/graphql', bodyParser.json(), graphqlExpress({ schema: myGraphQLSchema, formatResponse: formatResponse.bind(logOptions) });\n\n...\n\nconst pubsub = wrapPubSub(new PubSub(), logOptions);\n```\n\n## Sample output\n\nOn each example the result of operation comes after `=\u003e`\n\n- Query:\n``` js\n{\"data\":{\"post\":{\"id\":20,\"title\":\"Post title 20\",\"content\":\"Post content 20\",\"__typename\":\"Post\",\"comments\":[{\"id\":39,\"content\":\"Comment title 1 for post 20\",\"__typename\":\"Comment\"},{\"id\":40,\"content\":\"Comment title 2 for post 20\",\"__typename\":\"Comment\"}]}}} \u003c= post({\"id\":\"20\"})\n```\n\n- Mutation:\n``` js\n{\"data\":{\"addCounter\":{\"amount\":21,\"__typename\":\"Counter\"}}} \u003c= addCounter({\"amount\":1})\n```\n\n- Subscription\n``` js\nsubscribe \u003c= onPostUpdated({\"endCursor\":11})\n```\n\n- Subscription message:\n``` js\n{\"data\":{\"counterUpdated\":{\"amount\":21,\"__typename\":\"Counter\"}}} \u003c= onCounterUpdated\n```\n\n- Unsubscription\n``` js\nunsubscribe \u003c= onPostUpdated({\"endCursor\":11})\n```\n\n- PubSub publish on a server:\n``` js\npubsub publish [ 'countUpdated',\n  { id: 1, created_at: null, updated_at: null, amount: 7 } ]\n```\n\n- PubSub subscribe on a server:\n``` js\npubsub subscribe postsUpdated =\u003e 2\n```\n\n- PubSub unsubscribe on a server:\n``` js\npubsub unsubscribe [ 2 ]\n```\n\n- PubSub message generated on a server:\n``` js\npubsub msg postsUpdated({\"mutation\":\"CREATED\",\"id\":21,\"node\":{\"id\":21,\"title\":\"New post 1\"}})\n```\n\n## License\nCopyright © 2017 [SysGears INC]. This source code is licensed under the [MIT] license.\n\n[MIT]: LICENSE\n[SysGears INC]: http://sysgears.com\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsysgears%2Fapollo-logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsysgears%2Fapollo-logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsysgears%2Fapollo-logger/lists"}