Commit Graph

31 Commits

Author SHA1 Message Date
Dave Protasowski 8cd47b5af3
drop excess logger properties (#1993) 2021-01-20 12:02:53 -08:00
Markus Thömmes 261c9b4624
Remove unnecessary intermediate loggers (#1969)
* Remove unnecessary intermediate loggers

* Make linter happy

* Collapse logging variable into if contexts
2020-12-16 08:27:58 -08:00
Victor Agababov 7e918163fc
Fix some nits around logging (#1946) 2020-12-07 14:50:40 -08:00
Ian Milligan a536174bdf
Use zapdriver config as base zap config (#1773)
* Use zapdriver config as base zap config

Changes the encoding of the timestamp, severity, and message fields to
be parseable by Stackdriver.

* Wrap zap core with zapdriver core

Automatically adds labels and source location to log messages.
2020-12-03 11:31:09 -08:00
Dave Protasowski c4c261429d
include a message when the logging config is bad (#1892)
* include a message when the logging config is bad

* tweak warning message
2020-11-03 20:51:04 -08:00
Markus Thömmes 565516e224
Add errorlint and fix all existing issues (#1855) 2020-10-29 01:14:35 -07:00
Victor Agababov 2fd5431265
Downstream is updated, to remove outdated methods (#1856) 2020-10-27 12:23:33 -07:00
Victor Agababov 5394608723
Add proper cased function to deprecate the old one (#1848)
* Add proper cased function to deprecate the old one

Json -> JSON
2 less linter errors!

* cmt
2020-10-26 14:18:41 -07:00
Josh Soref b39d5da935
Spelling (#1797)
* spelling: adopted

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: aliased

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: apierrs

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: assignment

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: available

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: coexistence

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: commit

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: conversions

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: creates

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: custom

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: determine

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: different

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: distribution

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: duplicate

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: editing

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: endpoint

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: environment

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: generate

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: implementation

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: identified

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: ignore

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: indicates

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: interface

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: interleaved

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: labels

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: label

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: mimic

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: namespaced

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: necessary

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: organization

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: populatable

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: prometheus

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: refer

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: reference

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: repetitive

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: response

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: something

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: specable

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: spoofing

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: synchronized

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: this

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: trailing

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: unsupported

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: validation

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* chore: reviewdog go header boilerplate

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2020-10-18 14:22:57 -07:00
Victor Agababov 7bad843466
Enable golint and exclude some other generated or additional dirs (#1783)
* Enable golint and exclude some other generated or additional dirs

Also remove `test` ignore, since it's covered by path ignore rule.

* meh

* fixes

* more

* progressing

* further

* like a boss
2020-10-07 14:58:20 -07:00
Markus Thömmes 5fbbde31b3
Align linters with serving (enables stylecheck and asciicheck) (#1738) 2020-09-23 07:37:40 -07:00
Victor Agababov 7aa8743aaa
Some minor test coverage improvements and code flow improvements (#1649)
This way it's shorter and easier to read and also cover those super-important functions with
unit tests, since why not? :)
2020-08-24 15:46:47 -07:00
Victor Agababov fef70cc261
Unexport some constants (#1393)
* fix the space issue

* merge shenanigans

* nit and tests

* Unexport some constants that don't seem to be used anywhere
2020-06-09 11:40:32 -07:00
Victor Agababov 66f1d63f10
Fix logging around pkg (#1310)
- use more performant functions (mostly remove formatters were possible)
- move zap.Error() to the call site, rather than creating a new sugared logger with a key attached (not cheap)
- fix *w usages where the key was not provided.
2020-05-07 15:00:45 -07:00
Victor Agababov 0eed424fa4
Cleanup the logging CM handling. (#1223)
Raise test coverage, improve code flow, etc.
2020-04-14 16:31:46 -07:00
coryrc d3841ea2c3 Remove ugly constant string being printed in every log. (#878)
In every log we get the ugly string printed:
2019-11-13T08:44:42.421-0800    info    logging/config.go:50
Successfully created the logger.    {"knative.dev/jsonconfig": "{\n\t
\"level\": \"debug\",\n\t  \"encoding\": \"console\",\n\t
\"outputPaths\": [\"stdout\"],\n\t  \"errorOutputPaths\":
[\"stderr\"],\n\t  \"encoderConfig\": {\n\t    \"timeKey\":
\"ts\",\n\t    \"messageKey\": \"message\",\n\t    \"levelKey\":
\"level\",\n\t    \"nameKey\": \"logger\",\n\t    \"callerKey\":
\"caller\",\n\t    \"messageKey\": \"msg\",\n\t    \"stacktraceKey\":
\"stacktrace\",\n\t    \"lineEnding\": \"\",\n\t    \"levelEncoder\":
\"\",\n\t    \"timeEncoder\": \"iso8601\",\n\t    \"durationEncoder\":
\"\",\n\t    \"callerEncoder\": \"\"\n\t  }\n\t}"}

It's all a constant (see test/logging/logging.go:newLogger), except
"level", which is then printed immediately afterward. So just remove
printing this string.
2019-11-13 19:30:28 -08:00
Markus Thömmes 56c2594e4f Assorted linting fixes. (#840)
* Remove unused code.

* Remove unneeded loops.

* Remove unneeded Printf calls.

* Use time.Since instead of time.Now().Sub.

* Remove unused values.

* Rename error variable according to conventions.

* Return error last.

* Simplify array allocations.

* Remove leaky ticker.

* Remove Yoda conditions.

* Remove deprecated function to talk to GKE.

* Remove dot import.

* Remove empty critical section and replace with a channel operation.

* Add linter directives to explicitly state wanted weirdness.

* Update deps.

* Fix broken line.
2019-11-01 12:49:12 -07:00
Antoine Cotten ec5f5148b8 Do not override log level if component is undefined in logging config (#780)
* Do not override log level if component undefined

* review(vagababov): Remove empty line
2019-10-20 14:14:22 -07:00
Markus Thömmes 7b725e1ae6 Use a nil map instead of an empty map for the same effect. (#695) 2019-09-19 13:00:00 -07:00
Ignacio Cano c56cedc7e7 Serializing/Deserializing Logging and Metrics configs (#656)
* source stats reporter... should be used by well-behaved sources

* public fields

* moving serialization/deserialization of metrics and logging maps to pkg

* nits

* adding UT

* same order

* updates

* sock-puppet

* unregistration problem?

* removing base64 encoding

* removing TODO

* comments after review

* removing the other constants
2019-09-10 12:36:29 -07:00
Andrea Frittoli 554d86c2d5 Reducing the log level for github commit to info (#506)
The logger by default attempts to fetch the commit id from kodata.
When that fails log a message with info rather than warning, to
avoid creating spurious warning message when starting applications.

Fixes #505

Signed-off-by: Andrea Frittoli <andrea.frittoli@uk.ibm.com>
2019-08-28 12:58:41 -07:00
Matt Moore 222dd25986 Migrate pkg to use the knative.dev/pkg import path (#489)
* Manual changes.

* scripted changes.
2019-06-26 13:02:06 -07:00
Adam Harwayne 67d95db076 Logging config parses all components, rather than just a list passed in. (#436)
* Logging config pares all components, rather than just a list passed in.

* Simplify the prefix checking logic.

* PR comment - ignore empty string.

* Unit test.
2019-05-30 15:23:31 -07:00
Matt Moore 2923ca42d9 Share the configmap name logic for Logging and Metrics. (#425)
This also adds a way to fetch the metrics "domain" following a similar pattern to `system.Namespace()`.
2019-05-27 18:41:29 -07:00
Victor Agababov c100323403 Fix the sugared logger usage (#300)
* Fix the sugared logger usage

Without `w` the logged messages are quite useless and annoying.

* some more magic
2019-02-28 18:17:38 -08:00
Matt Moore 77b7b13190 Move the defaulting for ConfigMap into our logging library. (#258)
Progress towards: https://github.com/knative/serving/issues/2668
2019-01-30 21:59:37 -08:00
Yanwei Guo 088e3f7faf Add the commit ID key as constant for log label (#158)
* add the commit id constant

* add changeset lib

* add doc.go with explanation
2018-11-06 14:59:36 -08:00
Dave Protasowski 0122abd983 The test logger will now log the correct caller (#63)
Previous, since we weren't skipping, the logged caller
would be 'logging.go'
2018-09-06 14:16:14 -07:00
Shashwathi bba99e266c Use fallback named logger (#30) 2018-07-31 14:19:37 -07:00
Matt Moore 9d1975b29f Drop the fixed list of `knative/serving` components from logging. (#22) 2018-07-27 10:14:36 -07:00
Matt Moore 8b7b2d7cfb Move the logging packages from serving into pkg. (#21) 2018-07-27 09:53:35 -07:00