Skip to content

Commit

Permalink
Merge pull request #34 from thockin/godoc-and-headers
Browse files Browse the repository at this point in the history
Godoc and headers
  • Loading branch information
thockin authored Jan 5, 2021
2 parents 4fa77cb + 4eabc2e commit a9c9b25
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 16 deletions.
16 changes: 16 additions & 0 deletions discard.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
Copyright 2020 The logr Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package logr

// Discard returns a valid Logger that discards all messages logged to it.
Expand Down
16 changes: 16 additions & 0 deletions discard_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
Copyright 2020 The logr Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package logr

import (
Expand Down
31 changes: 15 additions & 16 deletions logr.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,15 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// Package logr defines abstract interfaces for logging. Packages can depend on
// these interfaces and callers can implement logging in whatever way is
// appropriate.
//
// This design derives from Dave Cheney's blog:
// http://dave.cheney.net/2015/11/05/lets-talk-about-logging
//
// This is a BETA grade API. Until there is a significant 2nd implementation,
// I don't really know how it will change.
//
// The logging specifically makes it non-trivial to use format strings, to encourage
// attaching structured information instead of unstructured format strings.

// Package logr defines abstract interfaces for logging. Packages can depend on
// these interfaces and callers can implement logging in whatever way is
// appropriate.
//
// Usage
//
Expand Down Expand Up @@ -114,14 +111,14 @@ limitations under the License.
// generally best to avoid using the following keys, as they're frequently used
// by implementations:
//
// - `"caller"`: the calling information (file/line) of a particular log line.
// - `"error"`: the underlying error value in the `Error` method.
// - `"level"`: the log level.
// - `"logger"`: the name of the associated logger.
// - `"msg"`: the log message.
// - `"stacktrace"`: the stack trace associated with a particular log line or
// error (often from the `Error` message).
// - `"ts"`: the timestamp for a log line.
// * `"caller"`: the calling information (file/line) of a particular log line.
// * `"error"`: the underlying error value in the `Error` method.
// * `"level"`: the log level.
// * `"logger"`: the name of the associated logger.
// * `"msg"`: the log message.
// * `"stacktrace"`: the stack trace associated with a particular log line or
// error (often from the `Error` message).
// * `"ts"`: the timestamp for a log line.
//
// Implementations are encouraged to make use of these keys to represent the
// above concepts, when necessary (for example, in a pure-JSON output form, it
Expand Down Expand Up @@ -190,7 +187,9 @@ type Logger interface {
WithName(name string) Logger
}

// InfoLogger provides compatibility with code that relies on the v0.1.0 interface
// InfoLogger provides compatibility with code that relies on the v0.1.0
// interface.
//
// Deprecated: use Logger instead. This will be removed in a future release.
type InfoLogger = Logger

Expand Down

0 comments on commit a9c9b25

Please sign in to comment.