Minimal structured logging library for Go

Overview

slog

GitHub Release GoDoc Coveralls CI Status

slog is a minimal structured logging library for Go.

Install

go get cdr.dev/slog

Features

Example

Many more examples available at godoc.

log := slog.Make(sloghuman.Sink(os.Stdout))

log.Info(context.Background(), "my message here",
    slog.F("field_name", "something or the other"),
    slog.F("some_map", slog.M(
        slog.F("nested_fields", time.Date(2000, time.February, 5, 4, 4, 4, 0, time.UTC)),
    )),
    slog.Error(
        xerrors.Errorf("wrap1: %w",
            xerrors.Errorf("wrap2: %w",
                io.EOF,
            ),
        ),
    ),
)

Example output screenshot

Why?

At Coder we’ve used Uber’s zap for several years. It is a fantastic library for performance. Thanks Uber!

However we felt the API and developer experience could be improved.

Here is a list of reasons how we improved on zap with slog.

  1. slog has a minimal API surface

    • Compare slog to zap and zapcore.
    • The sprawling API makes zap hard to understand, use and extend.
  2. slog has a concise semi typed API

    • We found zap's fully typed API cumbersome. It does offer a sugared API but it's too easy to pass an invalid fields list since there is no static type checking. Furthermore, it's harder to read as there is no syntax grouping for each key value pair.
    • We wanted an API that only accepted the equivalent of zap.Any for every field. This is slog.F.
  3. sloghuman uses a very human readable format

    • It colors distinct parts of each line to make it easier to scan logs. Even the JSON that represents the fields in each log is syntax highlighted so that is very easy to scan. See the screenshot above.
      • zap lacks appropriate colors for different levels and fields
    • slog automatically prints one multiline field after the log to make errors and such much easier to read.
      • zap logs multiline fields and errors stack traces as JSON strings which made them unreadable in a terminal.
    • When logging to JSON, slog automatically converts a golang.org/x/xerrors chain into an array with fields for the location and wrapping messages.
  4. Full context.Context support

    • slog lets you set fields in a context.Context such that any log with the context prints those fields.
    • We wanted to be able to pull up all relevant logs for a given trace, user or request. With zap, we were plugging these fields in for every relevant log or passing around a logger with the fields set. This became very verbose.
  5. Simple and easy to extend

    • A new backend only has to implement the simple Sink interface.
    • The Logger type provides a nice API around Sink but also implements Sink to allow for composition.
    • zap is hard and confusing to extend. There are too many structures and configuration options.
  6. Structured logging of Go structures with json.Marshal

    • Entire encoding process is documented on godoc.
    • With zap, We found ourselves often implementing zap's ObjectMarshaler to log Go structures. This was verbose and most of the time we ended up only implementing fmt.Stringer and using zap.Stringer instead.
  7. slog takes inspiration from Go's stdlib and implements slog.Helper which works just like t.Helper

    • It marks the calling function as a helper and skips it when reporting location info.
    • We had many helper functions for logging but we wanted the line reported to be of the parent function. zap has an API for this but it's verbose and requires passing the logger around explicitly.
  8. Tight integration with stdlib's testing package

    • You can configure slogtest to exit on any ERROR logs and it has a global stateless API that takes a testing.TB so you do not need to create a logger first.
    • Test assertion helpers are provided in slogtest/assert.
    • zap has zaptest but the API surface is large and doesn't integrate well. It does not support any of the features described above.
Issues
  • Reconsider number of logging levels

    Reconsider number of logging levels

    See @peterbourgon's criticism at https://lobste.rs/s/tofgzk/cdr_slog_minimal_structured_logging#c_beo2sc

    I fully agree regarding the logging levels. I do want to minimize the number of logs.

    Will require some thought.

    @cdr/engineering

    cleanup 
    opened by nhooyr 9
  • chore: bump cloud.google.com/go/compute from 0.1.0 to 1.6.1

    chore: bump cloud.google.com/go/compute from 0.1.0 to 1.6.1

    Bumps cloud.google.com/go/compute from 0.1.0 to 1.6.1.

    Release notes

    Sourced from cloud.google.com/go/compute's releases.

    compute: v1.6.1

    1.6.1 (2022-04-21)

    Bug Fixes

    • compute: revert proto3_optional, required removal on parent_id (#714) (d4ea7dd)

    aiplatform: v1.6.0

    1.6.0 (2022-03-14)

    Features

    compute: v1.6.0

    1.6.0 (2022-04-14)

    Features

    • compute: update compute API to revision 20220322 (#710) (bb5da6b)

    Bug Fixes

    • compute: remove proto3_optional from parent_id (#712) (19a9ef2)
    • compute: replace missing REQUIRED for parent_id (#711) (19a9ef2)

    securitycenter: v1.6.0

    1.6.0 (2022-04-14)

    Features

    • securitycenter: Add iam_binding field to findings attributes. It represents particular IAM bindings, which captures a member's role addition, removal, or state (bb5da6b)
    • securitycenter: Add next_steps field to finding's list of attributes (19a9ef2)

    osconfig: v1.5.0

    1.5.0 (2022-02-23)

    Features

    • osconfig: set versionClient to module version (55f0d92)

    securitycenter: v1.5.0

    1.5.0 (2022-03-14)

    ... (truncated)

    Changelog

    Sourced from cloud.google.com/go/compute's changelog.

    Changes

    0.101.0 (2022-04-20)

    Features

    Bug Fixes

    • internal/gapicgen: add generation of internal/version.go for new client modules (#5726) (341e0df)
    • internal/gapicgen: don't gen version files for longrunning and debugger (#5698) (3a81108)
    • internal/gapicgen: don't try to make snippets for non-gapics (#5919) (c94dddc)
    • internal/gapicgen: move breaking change indicator if present (#5452) (e712df5)
    • internal/godocfx: prevent errors for filtered mods (#5485) (6cb9b89)

    0.100.0 (2022-01-04)

    Features

    • analytics/admin: add the AcknowledgeUserDataCollection operation which acknowledges the terms of user data collection for the specified property feat: add the new resource type DataStream, which is planned to eventually replace WebDataStream, IosAppDataStream, AndroidAppDataStream resources fix!: remove GetEnhancedMeasurementSettings, UpdateEnhancedMeasurementSettingsRequest, UpdateEnhancedMeasurementSettingsRequest operations from the API feat: add CreateDataStream, DeleteDataStream, UpdateDataStream, ListDataStreams operations to support the new DataStream resource feat: add DISPLAY_VIDEO_360_ADVERTISER_LINK, DISPLAY_VIDEO_360_ADVERTISER_LINK_PROPOSAL fields to ChangeHistoryResourceType enum feat: add the account field to the Property type docs: update the documentation with a new list of valid values for UserLink.direct_roles field (5444809)
    • assuredworkloads: EU Regions and Support With Sovereign Controls (5444809)
    • dialogflow/cx: added the display name of the current page in webhook requests (e0833b2)
    • dialogflow/cx: added the display name of the current page in webhook requests (e0833b2)
    • dialogflow: added export documentation method feat: added filter in list documentations request feat: added option to import custom metadata from Google Cloud Storage in reload document request feat: added option to apply partial update to the smart messaging allowlist in reload document request feat: added filter in list knowledge bases request (5444809)
    • dialogflow: removed OPTIONAL for speech model variant docs: added more docs for speech model variant and improved docs format for participant (5444809)
    • recaptchaenterprise: add new reCAPTCHA Enterprise fraud annotations (3dd34a2)

    Bug Fixes

    • artifactregistry: fix resource pattern ID segment name (5444809)
    • compute: add parameter in compute bazel rules (#692) (5444809)
    • profiler: refine regular expression for parsing backoff duration in E2E tests (#5229) (4438aeb)
    • profiler: remove certificate expiration workaround (#5222) (2da36c9)

    0.99.0 (2021-12-06)

    Features

    • dialogflow/cx: added TelephonyTransferCall in response message (fe27098)

    0.98.0 (2021-12-03)

    ... (truncated)

    Commits
    • 407eb37 chore: release pubsub/v1.6.1 (#2648)
    • 0f60593 fix(pubsub): parse EnableMessageOrdering on GetSubscription (#2647)
    • 29aebdf feat(firestore): implement limitToLast (#2420)
    • f942d35 chore(all): update all (#2642)
    • bfdc8db fix(storage): add retry for TestIntegration_DeleteObjectInBucketWithRetention...
    • a2be9c9 feat(all): auto-regenerate gapics (#2641)
    • 94ec136 feat(all): auto-regenerate gapics (#2639)
    • 4b2f0b9 feat(all): auto-regenerate gapics (#2638)
    • 22b9552 fix(profiler): fix order of units in regexp used to parse backoff duration (#...
    • 5ea6f1f feat(all): auto-regenerate gapics (#2636)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies go 
    opened by dependabot[bot] 5
  • chore: bump cloud.google.com/go from 0.83.0 to 0.84.0

    chore: bump cloud.google.com/go from 0.83.0 to 0.84.0

    Bumps cloud.google.com/go from 0.83.0 to 0.84.0.

    Release notes

    Sourced from cloud.google.com/go's releases.

    google-cloud-go v0.84.0

    Features

    • aiplatform: start generating apiv1 (be1d729)
    • apigeeconnect: start generating abiv1 (be1d729)
    • dialogflow/cx: support sentiment analysis in bot testing (7a57aac)
    • dialogflow/cx: support sentiment analysis in bot testing (6ad2306)
    • documentai: Move CommonOperationMetadata into a separate proto file for potential reuse. (9e80ea0)
    • documentai: Move CommonOperationMetadata into a separate proto file for potential reuse. (18375e5)
    • gkeconnect/gateway: start generating apiv1beta1 (#4235) (1c3e968)
    • lifesciences: strat generating apiv2beta (be1d729)
    • tpu: start generating apiv1 (#4199) (cac48ea)

    Bug Fixes

    • bttest: fix race condition in SampleRowKeys (#4207) (5711fb1)
    • documentai: Fix Ruby gem title of documentai v1 (package not currently published) (9e80ea0)
    Changelog

    Sourced from cloud.google.com/go's changelog.

    0.84.0 (2021-06-09)

    Features

    • aiplatform: start generating apiv1 (be1d729)
    • apigeeconnect: start generating abiv1 (be1d729)
    • dialogflow/cx: support sentiment analysis in bot testing (7a57aac)
    • dialogflow/cx: support sentiment analysis in bot testing (6ad2306)
    • documentai: Move CommonOperationMetadata into a separate proto file for potential reuse. (9e80ea0)
    • documentai: Move CommonOperationMetadata into a separate proto file for potential reuse. (18375e5)
    • gkeconnect/gateway: start generating apiv1beta1 (#4235) (1c3e968)
    • lifesciences: strat generating apiv2beta (be1d729)
    • tpu: start generating apiv1 (#4199) (cac48ea)

    Bug Fixes

    • bttest: fix race condition in SampleRowKeys (#4207) (5711fb1)
    • documentai: Fix Ruby gem title of documentai v1 (package not currently published) (9e80ea0)
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies go 
    opened by dependabot[bot] 4
  • Unable to use v2

    Unable to use v2

    I get the following error when trying to import v2 of the logger: go get cdr.dev/[email protected]: cdr.dev/[email protected]: invalid version: module contains a go.mod file, so major version must be compatible: should be v0 or v1, not v2

    go get cdr.dev/[email protected]: cdr.dev/[email protected]: invalid version: module contains a go.mod file, so major version must be compatible: should be v0 or v1, not v2

    opened by hassieswift621 4
  • Configurable human logger

    Configurable human logger

    The human logger should allow for a configuration struct which lets the developer hide things like the timestamp and file name. We could also allow for forcibly disabling colors through this config struct too.

    package sloghuman
    
    type Config struct {
        HideTimestamp bool
        HideFile bool
        ...
    }
    
    func MakeConfig(w io.Writer, c Config) slog.Logger {}
    
    feature 
    opened by deansheather 4
  • Format alternate nested arrays without dash

    Format alternate nested arrays without dash

    Will improve our xerrors formatting a lot.

    Though tbh it’d seem really bizarre to not have fields for loc and whatnot cause the number of fields is fixed and it’s semantically a map.

    feature 
    opened by nhooyr 4
  • chore: bump cloud.google.com/go from 0.94.0 to 0.94.1

    chore: bump cloud.google.com/go from 0.94.0 to 0.94.1

    Bumps cloud.google.com/go from 0.94.0 to 0.94.1.

    Release notes

    Sourced from cloud.google.com/go's releases.

    google-cloud-go v0.94.1

    Bug Fixes

    • compute/metadata: fix retry logic to not panic on error (#4714) (75c63b9), refs #4713
    Changelog

    Sourced from cloud.google.com/go's changelog.

    0.94.1 (2021-09-02)

    Bug Fixes

    • compute/metadata: fix retry logic to not panic on error (#4714) (75c63b9), refs #4713
    Commits
    • 0055466 chore: release 0.94.1 (#4716)
    • 75c63b9 fix(compute/metadata): fix retry logic to not panic on error (#4714)
    • a0f7a02 feat(firestore): Support DocumentRefs in OrderBy, Add Query.Serialize, Query....
    • d6d4a3c test(pubsublite): fix flaky TestAssigningSubscriberAddRemovePartitions (#4564)
    • 27c3ed0 chore: release storage 1.16.1 (#4441)
    • See full diff in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies go 
    opened by dependabot[bot] 3
  • chore: bump cloud.google.com/go from 0.91.1 to 0.93.3

    chore: bump cloud.google.com/go from 0.91.1 to 0.93.3

    Bumps cloud.google.com/go from 0.91.1 to 0.93.3.

    Release notes

    Sourced from cloud.google.com/go's releases.

    v0.92.3

    As of this release the following directories have been made into their own standalone module:

    • cloudbuild
    • monitoring
    • analytics
    • area120
    • gkeconnect
    • gkehub
    • grafeas
    • security
    • video
    • secretmanager

    This means they will no longer be found in the root cloud.google.com/go module. When updating your code running go mod tidy should start pulling in the new sub-modules.

    v0.92.2

    Announcement

    As of this release the following directories have been made into their own standalone module:

    • datastream
    • dialogflow
    • dlp
    • documentai
    • domains
    • errorreporting
    • essentialcontacts
    • eventarc
    • functions
    • gaming
    • gsuiteaddons
    • iap
    • iot
    • kms
    • language
    • lifesciences
    • managedidentities
    • mediatranslation
    • memcache
    • metastore
    • networkconnectivity
    • networkmanagement
    • notebooks
    • orgpolicy
    • osconfig
    • oslogin
    • phishingprotection
    • policytroubleshooter
    • privatecatalog
    • profiler

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies go 
    opened by dependabot[bot] 3
  • chore: bump cloud.google.com/go from 0.91.1 to 0.92.1

    chore: bump cloud.google.com/go from 0.91.1 to 0.92.1

    Bumps cloud.google.com/go from 0.91.1 to 0.92.1.

    Release notes

    Sourced from cloud.google.com/go's releases.

    v0.92.1

    Announcement

    As of this release the following directories have been made into their own standalone module:

    • accessapproval
    • aiplatform
    • apigateway
    • apigeeconnect
    • appengine
    • artifactregistry
    • asset
    • assuredworkloads
    • automl
    • billing
    • binaryauthorization
    • channel
    • clouddms
    • cloudtasks
    • container
    • containeranalysis
    • datacatalog
    • dataflow
    • datafusion
    • datalabeling
    • dataproc
    • dataqna

    This means they will no longer be found in the root cloud.google.com/go module. When updating your code running go mod tidy should start pulling in the new sub-modules.

    google-cloud-go v0.92.0

    Features

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies go 
    opened by dependabot[bot] 3
  • I Get A Garbled results

    I Get A Garbled results

    2019-12-13 02:02:43.229 ?[34m[INFO]?[0m ?[36macc.go:19?[0m my message here {?[34m"field_name"?[0m: ?[32m"something or the other"?[0m, ?[34m"some_map"?[0m: {?[34m"nested_fields"?[0m: ?[32m"wowow"?[0m}} ... ?[34m"error"?[0m: wrap1: main.main C:/Users/xxx/Desktop/gotest/acc.go:25 - wrap2: main.main C:/Users/xxx/Desktop/gotest/acc.go:26 - EOF

    opened by uyaddayu 3
  • Proposed changes to the narrative

    Proposed changes to the narrative

    1. Reorder sections -> Install > Sample > Why > Features
    2. Change the Why section so it talks about where does slog shine vs where does Uber library fall short

    from: We wanted tighter integration with stdlib's testing package to: Tight integration with stdlib's testing package

    1. Consider merge the Why and Features section into one.
    2. Users section, consider rephrasing If your company or project is using slog, feel free to open an issue or PR to amend this list. vs Let others know you're using slog, open an issue or PR to amend this list

    Hope this helps

    DavidS

    docs release-blocker 
    opened by davidsalgado 3
  • chore: bump cloud.google.com/go/compute from 1.6.1 to 1.7.0

    chore: bump cloud.google.com/go/compute from 1.6.1 to 1.7.0

    Bumps cloud.google.com/go/compute from 1.6.1 to 1.7.0.

    Release notes

    Sourced from cloud.google.com/go/compute's releases.

    dialogflow: v1.7.0

    1.7.0 (2022-03-14)

    Features

    • dialogflow: added ConversationModel resource and its APIs feat: added ConversationDataset resource and its APIs feat: added SetSuggestionFeatureConfig and ClearSuggestionFeatureConfig APIs for ConversationProfile feat: added new knowledge type of Document content feat: added states of Document feat: added metadata for the Knowledge operation docs: updated copyright (96c9d7e)

    aiplatform: v1.7.0

    1.7.0 (2022-03-28)

    Features

    • aiplatform: add service_account to BatchPredictionJob in aiplatform v1beta1 batch_prediction_job.proto (b01c037)
    • aiplatform: add monitoring_config to EntityType in aiplatform v1 entity_type.proto feat: add disable_monitoring to Feature in aiplatform v1 feature.proto feat: add monitoring_stats_anomalies to Feature in aiplatform v1 feature.proto feat: add staleness_days to SnapshotAnalysis in aiplatform v1 featurestore_monitoring.proto feat: add import_features_analysis to FeaturestoreMonitoringConfig in aiplatform v1 featurestore_monitoring.proto feat: add numerical_threshold_config to FeaturestoreMonitoringConfig in aiplatform v1 featurestore_monitoring.proto feat: add categorical_threshold_config to FeaturestoreMonitoringConfig in aiplatform v1 featurestore_monitoring.proto feat: add objective to MonitoringStatsSpec in aiplatform v1 featurestore_service.proto (c19b7a2)

    securitycenter: v1.7.0

    1.7.0 (2022-04-20)

    Features

    • securitycenter: Add connection and description field to finding's list of attributes (689cad9)

    compute: v1.7.0

    1.7.0 (2022-06-16)

    Features

    • compute: Update Compute Engine API to revision 20220526 (#722) (4134941)
    Commits
    • 6ee5890 Merge branch 'master' of ssh://github.com/googleapis/google-cloud-go
    • 9f44d66 chore(pubsub): release pubsub/v1.7.0 (#2922)
    • aa569b9 chore(pubsub): release pubsub/v1.7.0
    • fc5b336 feat(pubsub/pstest): Add reactor options to pstest server (#2916)
    • fa82905 feat(all): auto-regenerate gapics (#2919)
    • 63ca165 chore(godocfx): mark methods as methods (#2917)
    • 04c7e36 feat(all): auto-regenerate gapics (#2913)
    • d5fb7cb feat(spanner/spansql): parse joins (#2896)
    • 411f8bc test(spanner/spansql): add fuzz target for ParseQuery (#2909)
    • 28b96a3 feat(all): auto-regenerate gapics (#2910)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies go 
    opened by dependabot[bot] 1
  • feat: Use human timestamp to display date

    feat: Use human timestamp to display date

    Showing day, year, and month feels excessive for human output.

    If logs are being ingested years at a time, the system consuming should be responsible for tracking the year.

    opened by kylecarbs 1
  • Some level of background logging

    Some level of background logging

    When a route is log heavy, the response shouldn't wait for all the logs to be marshalled/written.

    Right now it's the job of the sync but perhaps we should provide a configurable general wrapper for io.Writer.

    opened by nhooyr-ts 0
  • Implement api to accept empty error

    Implement api to accept empty error

    Zerolog has this nifty api log.Err(err error) that is Error level if err != nil and Info level if err == nil

    The basic gist to avoid this common code:

    authenticated, err := auth()
    if err != nil {
      slog.Error(ctx, "failed to authorize user"
        slog.Error(err),
        slog.F("user", "alice")
      )
      return
    }
    
    slog.Info(ctx, "authorized user",
        slog.F("user", "alice"),
    )
    ...
    

    and you can just do (the message becomes the action, and the Error level indicates the action failed):

    authenticated, err := auth()
    // Unsure exactly on the API, still adapting to slog, so unsure what would be "natural" 
    slog.Err(err).(ctx, "authorize user", 
      slog.F("user", "alice")
    )
    
    if err != nil {
      return
    }
    ...
    

    It is a small feature I miss. Let me know what you think.

    opened by Emyrk 4
  • Add package level functions for logging to the stderr logger

    Add package level functions for logging to the stderr logger

    Right now it's relatively difficult to find the default logger to use if an explicit logger is not available. It would be nice to be able to do

    slog.Error(...)
    
    feature 
    opened by sreya 1
Releases(v1.4.1)
Owner
Coder
We make it easy to write more code.
Coder
Gomol is a library for structured, multiple-output logging for Go with extensible logging outputs

gomol Gomol (Go Multi-Output Logger) is an MIT-licensed structured logging library for Go. Gomol grew from a desire to have a structured logging libra

Kristin Davidson 18 Dec 20, 2021
Hierarchical, leveled, and structured logging library for Go

spacelog Please see http://godoc.org/github.com/spacemonkeygo/spacelog for info License Copyright (C) 2014 Space Monkey, Inc. Licensed under the Apach

Space Monkey Go 98 Apr 27, 2021
A minimal and extensible structured logger

⚠️ PRE-RELEASE ⚠️ DO NOT IMPORT THIS MODULE YOUR PROJECT WILL BREAK package log package log provides a minimal interface for structured logging in ser

Go kit 102 Jun 8, 2022
Structured logging package for Go.

Package log implements a simple structured logging API inspired by Logrus, designed with centralization in mind. Read more on Medium. Handlers apexlog

Apex 1.2k Jun 28, 2022
Simple, configurable and scalable Structured Logging for Go.

log Log is a simple, highly configurable, Structured Logging library Why another logging library? There's allot of great stuff out there, but also tho

Go Playgound 280 Jun 22, 2022
Structured, composable logging for Go

log15 Package log15 provides an opinionated, simple toolkit for best-practice logging in Go (golang) that is both human and machine readable. It is mo

Alan Shreve 1.1k Jun 24, 2022
Structured, pluggable logging for Go.

Logrus Logrus is a structured logger for Go (golang), completely API compatible with the standard library logger. Logrus is in maintenance-mode. We wi

Simon Eskildsen 20.8k Jun 30, 2022
Structured Logging Made Easy

Structured Logging Made Easy Features Dependency Free Simple and Clean Interface Consistent Writer IOWriter, io.Writer wrapper FileWriter, rotating &

phuslu 427 Jun 30, 2022
Blazing fast, structured, leveled logging in Go.

⚡ zap Blazing fast, structured, leveled logging in Go. Installation go get -u go.uber.org/zap Note that zap only supports the two most recent minor ve

Uber Go 16.2k Jun 30, 2022
Logrus is a structured, pluggable logging for Go.

Logrus is a structured logger for Go (golang), completely API compatible with the standard library logger.

Simon Eskildsen 274 May 25, 2021
Fully asynchronous, structured, pluggable logging for Go.

logr Logr is a fully asynchronous, contextual logger for Go. It is very much inspired by Logrus but addresses two issues: Logr is fully asynchronous,

Mattermost 13 Mar 3, 2022
structured logging helper

Logart Logart is a structured logging tool that aims to simplify logging to a database It is not yet in stable state, but is used in production and ac

Karitham 3 Apr 24, 2021
Go-metalog - Standard API for structured logging

Metalog is a standard API for structured logging and adapters for its implementa

Kirill 4 Jan 20, 2022
📝 🪵 A minimal level based logging library for Go

slogx A minimal level based logging library for Go. Installation Example Usage Logger Log Level Format Output Contribute License Installation go get g

私はレオンです 7 May 23, 2022
A simple logging module for go, with a rotating file feature and console logging.

A simple logging module for go, with a rotating file feature and console logging. Installation go get github.com/jbrodriguez/mlog Usage Sample usage W

Juan B. Rodriguez 25 Jun 11, 2022
FactorLog is a logging infrastructure for Go that provides numerous logging functions for whatever your style may be

FactorLog FactorLog is a fast logging infrastructure for Go that provides numerous logging functions for whatever your style may be. It could easily b

Kevin Darlington 54 Oct 12, 2021
Package logging implements a logging infrastructure for Go

Golang logging library Package logging implements a logging infrastructure for Go. Its output format is customizable and supports different logging ba

Luke Zhang 0 Nov 10, 2021
Structured log interface

Structured log interface Package log provides the separation of the logging interface from its implementation and decouples the logger backend from yo

teris.io 24 Jan 3, 2021
Search and analysis tooling for structured logs

Zed The Zed system provides an open-source, cloud-native, and searchable data lake for semi-structured and structured data. Zed lakes utilize a supers

Brim 815 Jun 30, 2022