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

feat: deprecated logLevel option #8301

Merged
merged 11 commits into from Jan 19, 2021
3 changes: 2 additions & 1 deletion docs/development/configuration.md
Expand Up @@ -38,7 +38,6 @@ e.g. apply one set of labels for `backend/package.json` and a different set of l
module.exports = {
npmrc: '//registry.npmjs.org/:_authToken=abc123',
baseDir: '/tmp/renovate',
logLevel: 'debug',
includeForks: true,
gradle: { enabled: false },
};
Expand All @@ -53,6 +52,8 @@ $ node renovate --help
To configure any `<list>` items, separate with commas.
E.g. `renovate --labels=renovate,dependency`.

To enable debug logging export `LOG_LEVEL=debug` to your environment.

### renovate.json

If you add a `renovate.json` file to the root of your repository, you can use this to override default settings.
Expand Down
2 changes: 2 additions & 0 deletions docs/usage/self-hosted-configuration.md
Expand Up @@ -172,6 +172,8 @@ By configuring using the environment it means that debug logging starts from the

Additionally, if you configure `LOG_FORMAT=json` in env then logging will be done in JSON format instead of "pretty" format, which is usually better if you're doing any ingestion or parsing of the logs.

Warning: Configuring `logLevel` config option or `--log-level` cli option is deprecated and will be removed in a major version.

## onboarding

Set this to `false` if (a) you configure Renovate entirely on the bot side (i.e. empty `renovate.json` in repositories) and (b) you wish to run Renovate on every repository the bot has access to, and (c) you wish to skip the onboarding PRs.
Expand Down
2 changes: 0 additions & 2 deletions docs/usage/self-hosting.md
Expand Up @@ -101,7 +101,6 @@ metadata:
data:
config.json: |-
{
"logLevel" : "debug",
"repositories": ["orgname/repo","username/repo"],
"dryRun" : "true"
}
Expand Down Expand Up @@ -280,7 +279,6 @@ module.exports = {
endpoint: 'https://self-hosted.gitlab/api/v4/',
token: '**gitlab_token**',
platform: 'gitlab',
logLevel: 'debug',
onboardingConfig: {
extends: ['config:base'],
},
Expand Down
1 change: 0 additions & 1 deletion lib/config/config/__fixtures__/file.js
@@ -1,5 +1,4 @@
// @ts-ignore
module.exports = {
token: 'abcdefg',
logLevel: 'error'
};
1 change: 0 additions & 1 deletion lib/config/config/__fixtures__/with-force.js
@@ -1,7 +1,6 @@
// @ts-ignore
module.exports = {
token: 'abcdefg',
logLevel: 'error',
force: {
schedule: null,
}
Expand Down
4 changes: 1 addition & 3 deletions lib/config/definitions.ts
Expand Up @@ -350,12 +350,10 @@ const options: RenovateOptions[] = [
// Log options
{
name: 'logLevel',
description: 'Logging level',
description: 'Logging level. Deprecated, use `LOG_LEVEL` environment.',
stage: 'global',
type: 'string',
allowedValues: ['fatal', 'error', 'warn', 'info', 'debug', 'trace'],
default: 'info',
env: 'LOG_LEVEL',
},
{
name: 'logFile',
Expand Down
1 change: 0 additions & 1 deletion lib/config/file.spec.ts
Expand Up @@ -37,7 +37,6 @@ describe('config/file', () => {
"platform": "github",
"token":"abcdef",
"logFileLevel": "warn",
"logLevel": "info",
"onboarding": false,
"gitAuthor": "Renovate Bot <renovate@whitesourcesoftware.com>"
"onboardingConfig": {
Expand Down
10 changes: 8 additions & 2 deletions lib/config/index.ts
Expand Up @@ -80,8 +80,14 @@ export async function parseConfigs(
delete config.privateKeyPath;
}

// Set log level
levels('stdout', config.logLevel);
// Deprecated set log level: https://github.com/renovatebot/renovate/issues/8291
// istanbul ignore if
if (config.logLevel) {
logger.warn(
'Configuring logLevel in CLI or file is deprecated. Use LOG_LEVEL environment variable instead'
);
levels('stdout', config.logLevel);
}

if (config.logContext) {
// This only has an effect if logContext was defined via file or CLI, otherwise it would already have been detected in env
Expand Down