Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(trait): Polish Logging trait documentation #2403

Merged
merged 2 commits into from
Jun 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions deploy/traits.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -577,9 +577,9 @@ traits:
- Kubernetes
- Knative
- OpenShift
description: This trait is used to control logging options (such as color and the
format). The logging backend is provided by Quarkus and configuration details
for things like the the log format can be found on https://quarkus.io/guides/logging
description: The Logging trait is used to configure Integration runtime logging
options (such as color and format). The logging backend is provided by Quarkus,
whose configuration is documented at https://quarkus.io/guides/logging.
properties:
- name: enabled
type: bool
Expand All @@ -590,16 +590,16 @@ traits:
description: Colorize the log output
- name: format
type: string
description: Log message format
description: Logs message format
- name: level
type: string
description: Adjust the log level for the integrations (defaults to INFO)
description: Adjust the logging level (defaults to INFO)
- name: json
type: bool
description: Output the log in json format
description: Output the logs in JSON
- name: json-pretty-print
type: bool
description: Enable "pretty printing" of the json log
description: Enable "pretty printing" of the JSON logs
- name: master
platform: false
profiles:
Expand Down
12 changes: 6 additions & 6 deletions docs/modules/traits/pages/logging.adoc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
= Logging Trait

// Start of autogenerated code - DO NOT EDIT! (description)
This trait is used to control logging options (such as color and the format). The logging backend is provided by
Quarkus and configuration details for things like the the log format can be found on https://quarkus.io/guides/logging
The Logging trait is used to configure Integration runtime logging options (such as color and format).
The logging backend is provided by Quarkus, whose configuration is documented at https://quarkus.io/guides/logging.


This trait is available in the following profiles: **Kubernetes, Knative, OpenShift**.
Expand Down Expand Up @@ -32,19 +32,19 @@ The following configuration options are available:

| logging.format
| string
| Log message format
| Logs message format

| logging.level
| string
| Adjust the log level for the integrations (defaults to INFO)
| Adjust the logging level (defaults to INFO)

| logging.json
| bool
| Output the log in json format
| Output the logs in JSON

| logging.json-pretty-print
| bool
| Enable "pretty printing" of the json log
| Enable "pretty printing" of the JSON logs

|===

Expand Down
4 changes: 2 additions & 2 deletions pkg/resources/resources.go

Large diffs are not rendered by default.

16 changes: 7 additions & 9 deletions pkg/trait/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,26 @@ const (
envVarQuarkusLogConsoleFormat = "QUARKUS_LOG_CONSOLE_FORMAT"
envVarQuarkusLogConsoleJson = "QUARKUS_LOG_CONSOLE_JSON"
envVarQuarkusLogConsoleJsonPrettyPrint = "QUARKUS_LOG_CONSOLE_JSON_PRETTY_PRINT"
depQuarkusLoggingJson = "mvn:io.quarkus:quarkus-logging-json"
depQuarkusLoggingJson = "quarkus-logging-json"
defaultLogFormat = ""
defaultLogLevel = "INFO"
)

// This trait is used to control logging options (such as color and the format). The logging backend is provided by
// Quarkus and configuration details for things like the the log format can be found on https://quarkus.io/guides/logging
// The Logging trait is used to configure Integration runtime logging options (such as color and format).
// The logging backend is provided by Quarkus, whose configuration is documented at https://quarkus.io/guides/logging.
//
// +camel-k:trait=logging
type loggingTrait struct {
BaseTrait `property:",squash"`
// Colorize the log output
Color *bool `property:"color" json:"color,omitempty"`
// Log message format
// Logs message format
Format string `property:"format" json:"format,omitempty"`
// Adjust the log level for the integrations (defaults to INFO)
// Adjust the logging level (defaults to INFO)
Level string `property:"level" json:"level,omitempty"`
// Output the log in json format
// Output the logs in JSON
Json *bool `property:"json" json:"json,omitempty"`
// Enable "pretty printing" of the json log
// Enable "pretty printing" of the JSON logs
JsonPrettyPrint *bool `property:"json-pretty-print" json:"jsonPrettyPrint,omitempty"`
}

Expand All @@ -75,13 +75,11 @@ func (l loggingTrait) Configure(environment *Environment) (bool, error) {
}

func (l loggingTrait) Apply(environment *Environment) error {

if environment.IntegrationInPhase(v1.IntegrationPhaseInitialization) {
if *l.Json {
if environment.Integration.Status.Dependencies == nil {
environment.Integration.Status.Dependencies = make([]string, 0)
}

util.StringSliceUniqueAdd(&environment.Integration.Status.Dependencies, depQuarkusLoggingJson)
}

Expand Down