UNPKG

1.13 kBJavaScriptView Raw
1'use strict'
2
3const cli = require('heroku-cli-util')
4const settings = require('../../lib/setter')
5
6function explain (setting) {
7 if (setting.value === -1) {
8 return `The duration of each completed statement will not be logged.`
9 }
10 if (setting.value === 0) {
11 return `The duration of each completed statement will be logged.`
12 }
13 return `The duration of each completed statement will be logged if the statement ran for at least ${setting.value} milliseconds.`
14}
15
16module.exports = {
17 topic: 'pg',
18 command: 'settings:log-min-duration-statement',
19 description: `The duration of each completed statement will be logged if the statement completes after the time specified by VALUE.
20VALUE needs to specified as a whole number, in milliseconds.`,
21 help: `Setting log_min_duration_statement to zero prints all statement durations and -1 will disable logging statement durations.`,
22 needsApp: true,
23 needsAuth: true,
24 args: [{ name: 'value', optional: true }, { name: 'database', optional: true }],
25 run: cli.command({ preauth: true }, settings.generate('log_min_duration_statement', settings.numeric, explain))
26}