{"id":15984497,"url":"https://github.com/metcoder95/cloud-pine","last_synced_at":"2025-08-27T02:19:29.820Z","repository":{"id":50408490,"uuid":"516132804","full_name":"metcoder95/cloud-pine","owner":"metcoder95","description":"Pino Transport abstraction for Google Cloud Logging","archived":false,"fork":false,"pushed_at":"2025-08-11T19:28:03.000Z","size":78,"stargazers_count":13,"open_issues_count":7,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-22T12:47:13.074Z","etag":null,"topics":["cloud-logging","gcp","gcp-logging","google","pino","pino-transport"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/metcoder95.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yaml","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,"zenodo":null},"funding":{"github":"metcoder95"}},"created_at":"2022-07-20T20:58:33.000Z","updated_at":"2025-08-11T19:28:05.000Z","dependencies_parsed_at":"2024-01-01T23:40:42.589Z","dependency_job_id":"bb579605-7b5d-4be7-83b1-8439b6ba6edd","html_url":"https://github.com/metcoder95/cloud-pine","commit_stats":{"total_commits":51,"total_committers":3,"mean_commits":17.0,"dds":0.5490196078431373,"last_synced_commit":"33d7380cf34fd7b9237d8fd16841a839cd46a7e0"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":"metcoder95/lib_template","purl":"pkg:github/metcoder95/cloud-pine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metcoder95%2Fcloud-pine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metcoder95%2Fcloud-pine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metcoder95%2Fcloud-pine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metcoder95%2Fcloud-pine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/metcoder95","download_url":"https://codeload.github.com/metcoder95/cloud-pine/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metcoder95%2Fcloud-pine/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272280360,"owners_count":24906116,"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-08-27T02:00:09.397Z","response_time":76,"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":["cloud-logging","gcp","gcp-logging","google","pino","pino-transport"],"created_at":"2024-10-08T02:09:05.719Z","updated_at":"2025-08-27T02:19:29.797Z","avatar_url":"https://github.com/metcoder95.png","language":"JavaScript","funding_links":["https://github.com/sponsors/metcoder95"],"categories":[],"sub_categories":[],"readme":"[![CI](https://github.com/metcoder95/cloud-pine/actions/workflows/ci.yml/badge.svg)](https://github.com/metcoder95/cloud-pine/actions/workflows/ci.yml)\n[![CodeQL](https://github.com/metcoder95/cloud-pine/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/metcoder95/cloud-pine/actions/workflows/codeql-analysis.yml)\n![version](https://badge.fury.io/js/cloud-pine.svg)\n\n# Cloud Pine\n\nPino Transport that abstracts Google Cloud Logging implementation underneath.\n\n## Description\n\nThis library executes a thin abstraction of the [`@google-cloud/logging`](https://cloud.google.com/nodejs/docs/reference/logging/latest) client library.\nThe goal is to provide a clean support over Google Cloud Logging service for the Pino ecosystem using the Transport feature of Pino itself.\n\n### Usage\n\n#### How to use it?\n\nThe library can be used either by piping logs using the `pipe` operator on Linux, or programatically by installing it as part of your dependencies in you project.\n\n**Within your Dependencies**\n\nUsing it programatically, is easy as just install the library as part for your dependencies in any of the following ways:\n\n- **npm**: `npm install cloud-pine`\n\n- **yarn**: `yarn add cloud-pine`\n\n- **pnpm**: `pnpm install cloud-pine`\n\nOnce installed, is necessary to set it up as part of of your Pino transport configuration, an example can be:\n\n```js\nconst Pino = require('pino')\nconst logger = Pino({\n   transport: {\n      target: 'cloud-pine',\n      options: {\n         cloudLoggingOptions: {\n            skipInit: true,\n            sync: true,\n         }\n      }\n   }\n})\n\n\nlogger.info('hello world')\nlogger.error({ oops: 'hello!' }, 'error')\n```\n\nor in **TypeScript**\n\n```ts\nimport Pino from ('pino')\n\nconst logger = Pino({\n   transport: {\n      target: 'cloud-pine',\n      options: {\n         cloudLoggingOptions: {\n            skipInit: true,\n            sync: true,\n         }\n      }\n   }\n})\n\n\nlogger.info('hello world')\nlogger.error({ oops: 'hello!' }, 'error')\n```\n\n**NOTE**: The `projectId` string and `resource` object on the Logging instance are detected and set automatically 🎉\n\n**Configuration**\n`Cloud-Pine` supports the following configuration:\n\n```js\nconst cloudPine = {\n    logName: 'cloud-pine', // Name of the logging agent. Default to 'cloud-pine'\n    cloudLoggingOptions: {\n        googleCloudOptions: {}, // Configuration Object for establishing connection with Google Cloud Logging. Default to undefined. Ref: https://cloud.google.com/nodejs/docs/reference/logging/latest/logging/loggingoptions\n\n        resourceSettings: {}, // Resource settings hash, default to `{ type: 'global' }`. The hash is persisted across logs and inferred based on the API `Logging#setDetectedResource` result. Ref: https://cloud.google.com/logging/docs/reference/v2/rest/v2/MonitoredResource\n\n        defaultLabels: {}, // Labels hash, default to `{ logger: 'pino', agent: 'cloud_pine' }`. The hash is persisted across logs. Ref: https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry,\n\n        logOptions: {}, // Configuration object that is passed to the Log/LogSync instance. Default to undefined. Ref: https://cloud.google.com/nodejs/docs/reference/logging/latest/logging/log and https://cloud.google.com/nodejs/docs/reference/logging/latest/logging/logsync\n\n        skipInit: false, // Indicates wheter to skip the automatic inferr of `projectId` and `MonitoredResource` metadata. Default to `false`.\n\n        sync: false, // Indicates wheter to use a Log or LogSync instance. Default to false.\n    }\n}\n```\n\n\u003eFor more information about the `sync` and `async` diference, please take a look at the section [Sync or Async](#syncorasync)\n\n**CLI**\n\nWhen using it in CLI mode, all the logs are ingested automatically from `stdin`. In case exists some malformed log, the library will automatically dispatch an log with severity to `error` to Google Cloud Logging.\n\n**Usage**\n\nSee the following description for usage:\n```\nUsage: cat log | cloud-pine --projectid someprojectid -l something=else -l service=http\n\n  Flags\n  -h  | --help              Display Help\n\n  -v  | --version           Display Version\n\n  -n  | --name              Log Name. Default to Cloud_Pine\n\n  -s  | --sync              Cloud Logging Mode. Sync will print to `stdout`\n                            meanwhile async will forward logs to Cloud Logging.\n                            Default to true.\n\n  -p  | --projectid         Google Cloud Project ID. Default to automatic\n                            detected resource or\n                            `GOOGLE_APPLICATION_CREDENTIALS`\n\n  -k  | --key               Path to key file\n\n  -l  | --labels            Custom labels to be attached to the logging labels.\n                            Should be in the format `label=value`.\n                            Can be used one or more times.\n\n  -r  | --resource          Monitoring Resource type. Default to `type=global`\n                            or Monitored Resource detected.\n\n  -rs  | --resource-labels   Monitoring Resource#Labels that will be attached\n                            to the resource by default.\n                            Follows same pattern as `--labels`.\n\n  -i  | --skip-init         Skips identification of monitored resource, which\n                            will infer things like `project-id` and Monitored\n                            Resource settings. Default to false.\n```\n\n**TypeScript Interface**\n\n```ts\ntype CloudPineOptions = {\n  logName?: string;\n  cloudLoggingOptions: {\n    googleCloudOptions?: LoggingOptions;\n    resourceSettings?: {\n      type?: string;\n      labels: Record\u003cstring, string\u003e;\n    };\n    defaultLabels?: Record\u003cstring, string\u003e;\n    skipInit?: boolean;\n    sync?: boolean;\n    logOptions?: ConstructorParameters\u003ctypeof Log\u003e | ConstructorParameters\u003ctypeof LogSync\u003e;\n  };\n```\n\n### Sync or Async\n\u003ca id=\"syncorasync\"\u003e\u003c/a\u003e\n\nThe library can be used in either of two modes, `sync` or `async`.\n\nThe default mode for the CLI usage is `sync` meaning that all logs will be directly streamed to `stdout`, meanwhile the default mode for the Transport usage is `async`, where all the logs will be streamed directly to Google Cloud Logging service.\n\n\u003eFor more information about when to use one or another please take a look at the following documentation: [**Writting to `stdout`**](https://cloud.google.com/nodejs/docs/reference/logging/latest#writing-to-stdout).\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetcoder95%2Fcloud-pine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmetcoder95%2Fcloud-pine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetcoder95%2Fcloud-pine/lists"}