Skip to content
This repository has been archived by the owner on Jul 26, 2022. It is now read-only.

Commit

Permalink
feat(logging): add config to allow switching level format to human-re…
Browse files Browse the repository at this point in the history
…adable log levels (#429)

* Switch to human-readable log levels
* Switch human readable logs to env var

Co-authored-by: Markus Maga <markus@maga.se>
  • Loading branch information
davidcorbin and Flydiverny authored Jul 14, 2020
1 parent 95827bc commit 4602ad0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions charts/kubernetes-external-secrets/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ env:
AWS_DEFAULT_REGION: us-west-2
POLLER_INTERVAL_MILLISECONDS: 10000 # Caution, setting this frequency may incur additional charges on some platforms
LOG_LEVEL: info
# Print logs level as string ("info") rather than integer (30)
# USE_HUMAN_READABLE_LOG_LEVELS: true
METRICS_PORT: 3001
VAULT_ADDR: http://127.0.0.1:8200
# GOOGLE_APPLICATION_CREDENTIALS: /app/gcp-creds/gcp-creds.json
Expand Down
5 changes: 4 additions & 1 deletion config/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ const pollerIntervalMilliseconds = process.env.POLLER_INTERVAL_MILLISECONDS
? Number(process.env.POLLER_INTERVAL_MILLISECONDS) : 10000

const logLevel = process.env.LOG_LEVEL || 'info'
const useHumanReadableLogLevels = 'USE_HUMAN_READABLE_LOG_LEVELS' in process.env

const pollingDisabled = 'DISABLE_POLLING' in process.env

const rolePermittedAnnotation = process.env.ROLE_PERMITTED_ANNOTATION || 'iam.amazonaws.com/permitted'
Expand All @@ -43,5 +45,6 @@ module.exports = {
namingPermittedAnnotation,
pollingDisabled,
logLevel,
customResourceManagerDisabled
customResourceManagerDisabled,
useHumanReadableLogLevels
}
3 changes: 2 additions & 1 deletion config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ const logger = pino({
serializers: {
err: pino.stdSerializers.err
},
level: envConfig.logLevel
level: envConfig.logLevel,
useLevelLabels: envConfig.useHumanReadableLogLevels
})

const customResourceManager = new CustomResourceManager({
Expand Down

0 comments on commit 4602ad0

Please sign in to comment.