{"id":46728906,"url":"https://github.com/dentech-floss/logging","last_synced_at":"2026-03-09T14:33:46.557Z","repository":{"id":144424552,"uuid":"493180840","full_name":"dentech-floss/logging","owner":"dentech-floss","description":"Structured logging via slog for GCP: includes OpenTelemetry tracing, trace_id linking, and Error Reporting support.","archived":false,"fork":false,"pushed_at":"2026-02-13T09:11:21.000Z","size":107,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-02-13T16:27:58.021Z","etag":null,"topics":["gcp","go","golang","logging","observability","opentelemetry","opentelemetry-go"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dentech-floss.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-05-17T09:23:07.000Z","updated_at":"2026-02-13T09:11:09.000Z","dependencies_parsed_at":"2026-01-23T12:02:28.157Z","dependency_job_id":null,"html_url":"https://github.com/dentech-floss/logging","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"purl":"pkg:github/dentech-floss/logging","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dentech-floss%2Flogging","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dentech-floss%2Flogging/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dentech-floss%2Flogging/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dentech-floss%2Flogging/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dentech-floss","download_url":"https://codeload.github.com/dentech-floss/logging/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dentech-floss%2Flogging/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30299108,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T13:46:43.843Z","status":"ssl_error","status_checked_at":"2026-03-09T13:46:42.821Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["gcp","go","golang","logging","observability","opentelemetry","opentelemetry-go"],"created_at":"2026-03-09T14:33:45.837Z","updated_at":"2026-03-09T14:33:46.530Z","avatar_url":"https://github.com/dentech-floss.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# logging\n\nProvides a [slog](https://pkg.go.dev/log/slog) logger, configured for GCP Cloud Logging format and integrated with OpenTelemetry tracing. If the incoming context contains a trace, log messages will be recorded as events on the span, and log entries in GCP will include the \"trace_id\" field for improved observability.\n\nThe logger is also configured to support [Error Reporting](https://cloud.google.com/error-reporting) in GCP, automatically formatting error logs for reporting.\n\n## Install\n\n```\ngo get github.com/dentech-floss/logging@v0.3.4\n```\n\n## Usage\n\n```go\npackage example\n\nimport (\n    \"github.com/dentech-floss/metadata/pkg/metadata\"\n    \"github.com/dentech-floss/logging/pkg/logging\"\n    \"github.com/dentech-floss/revision/pkg/revision\"\n)\n\nfunc main() {\n\n    metadata := metadata.NewMetadata()\n\n    logger := logging.NewLogger(\n        \u0026logging.LoggerConfig{\n            ProjectID:    metadata.ProjectID,\n            ServiceName: revision.ServiceName,\n            MinLevel:    logging.InfoLevel,\n        },\n    )\n    defer logger.Sync() // flushes buffer, if any\n\n    patientGatewayServiceV1 := service.NewPatientGatewayServiceV1(logger) // inject it\n}\n```\n\n```go\npackage example\n\nimport (\n    \"github.com/dentech-floss/logging/pkg/logging\"\n\n    patient_gateway_service_v1 \"go.buf.build/dentechse/go-grpc-gateway-openapiv2/dentechse/patient-api-gateway/api/patient/v1\"\n)\n\nfunc (s *PatientGatewayServiceV1) FindAppointments(\n    ctx context.Context,\n    request *patient_gateway_service_v1.FindAppointmentsRequest,\n) (*patient_gateway_service_v1.FindAppointmentsResponse, error) {\n\n    // Ensure trace information + request is part of the log entries\n    log := s.logger.With(logging.Proto(\"request\", request))\n\n    log.InfoContext(\n        ctx,\n        \"Something something...\",\n        logging.String(\"something\", something),\n    )\n\n    startTimeLocal, err := datetime.ISO8601StringToTime(request.StartTime)\n    if err != nil {\n        log.WarnContext(ctx, \"The start time shall be in ISO 8601 format\", logging.Error(err))\n        return \u0026patient_gateway_service_v1.FindAppointmentsResponse{},\n            status.Errorf(codes.InvalidArgument, \"The start time shall be in ISO 8601 format\")\n    }\n}\n\n```\n\n```go\nimport (\n    \"net/http\"\n\n    \"github.com/dentech-floss/logging/pkg/logging\"\n    \"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp\"\n)\n\n// Example of wrapping an HTTP client's Transport with NewLoggingTransport\nhttpClient := \u0026http.Client{}\nhttpClient.Transport = otelhttp.NewTransport(\n    logging.NewLoggingTransport(\n        httpClient.Transport,\n        logger,\n        \u0026logging.LoggingOptions{\n            DumpRequestFunc:  logging.DumpRequest,\n            DumpResponseFunc: logging.DumpResponse,\n        },\n    ),\n)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdentech-floss%2Flogging","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdentech-floss%2Flogging","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdentech-floss%2Flogging/lists"}