Some automation fixes and adding option to disable logging for CLI.
This commit is contained in:
parent
400a112a4b
commit
4badd04e33
|
@ -1,5 +1,5 @@
|
||||||
export * as correlation from "./correlation/correlation"
|
export * as correlation from "./correlation/correlation"
|
||||||
export { default as logger } from "./pino/logger"
|
export { logger, disableLogger } from "./pino/logger"
|
||||||
export * from "./alerts"
|
export * from "./alerts"
|
||||||
|
|
||||||
// turn off or on context logging i.e. tenantId, appId etc
|
// turn off or on context logging i.e. tenantId, appId etc
|
||||||
|
|
|
@ -5,6 +5,17 @@ import * as correlation from "../correlation"
|
||||||
import { IdentityType } from "@budibase/types"
|
import { IdentityType } from "@budibase/types"
|
||||||
import { LOG_CONTEXT } from "../index"
|
import { LOG_CONTEXT } from "../index"
|
||||||
|
|
||||||
|
// CORE LOGGERS - for disabling
|
||||||
|
|
||||||
|
const BUILT_INS = {
|
||||||
|
log: console.log,
|
||||||
|
error: console.error,
|
||||||
|
info: console.info,
|
||||||
|
warn: console.warn,
|
||||||
|
trace: console.trace,
|
||||||
|
debug: console.debug,
|
||||||
|
}
|
||||||
|
|
||||||
// LOGGER
|
// LOGGER
|
||||||
|
|
||||||
const pinoOptions: LoggerOptions = {
|
const pinoOptions: LoggerOptions = {
|
||||||
|
@ -31,6 +42,15 @@ if (env.isDev()) {
|
||||||
|
|
||||||
export const logger = pino(pinoOptions)
|
export const logger = pino(pinoOptions)
|
||||||
|
|
||||||
|
export function disableLogger() {
|
||||||
|
console.log = BUILT_INS.log
|
||||||
|
console.error = BUILT_INS.error
|
||||||
|
console.info = BUILT_INS.info
|
||||||
|
console.warn = BUILT_INS.warn
|
||||||
|
console.trace = BUILT_INS.trace
|
||||||
|
console.debug = BUILT_INS.debug
|
||||||
|
}
|
||||||
|
|
||||||
// CONSOLE OVERRIDES
|
// CONSOLE OVERRIDES
|
||||||
|
|
||||||
interface MergingObject {
|
interface MergingObject {
|
||||||
|
@ -166,5 +186,3 @@ const getIdentity = () => {
|
||||||
}
|
}
|
||||||
return identity
|
return identity
|
||||||
}
|
}
|
||||||
|
|
||||||
export default logger
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
import { logging } from "@budibase/backend-core"
|
||||||
|
logging.disableLogger()
|
||||||
import "./prebuilds"
|
import "./prebuilds"
|
||||||
import "./environment"
|
import "./environment"
|
||||||
import { getCommands } from "./options"
|
import { getCommands } from "./options"
|
||||||
|
|
|
@ -54,7 +54,7 @@ async function init(opts: PluginOpts) {
|
||||||
if (!type || !PLUGIN_TYPE_ARR.includes(type)) {
|
if (!type || !PLUGIN_TYPE_ARR.includes(type)) {
|
||||||
console.log(
|
console.log(
|
||||||
error(
|
error(
|
||||||
"Please provide a type to init, either 'component' or 'datasource'."
|
"Please provide a type to init, either 'component', 'datasource' or 'automation'."
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
import { wait } from "../../utilities"
|
import { wait } from "../../utilities"
|
||||||
import {
|
import {
|
||||||
AutomationActionStepId,
|
AutomationActionStepId,
|
||||||
AutomationStepSchema,
|
AutomationIOType,
|
||||||
AutomationStepInput,
|
AutomationStepInput,
|
||||||
|
AutomationStepSchema,
|
||||||
AutomationStepType,
|
AutomationStepType,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
|
|
||||||
|
@ -18,7 +19,7 @@ export const definition: AutomationStepSchema = {
|
||||||
inputs: {
|
inputs: {
|
||||||
properties: {
|
properties: {
|
||||||
time: {
|
time: {
|
||||||
type: "number",
|
type: AutomationIOType.NUMBER,
|
||||||
title: "Delay in milliseconds",
|
title: "Delay in milliseconds",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -27,7 +28,7 @@ export const definition: AutomationStepSchema = {
|
||||||
outputs: {
|
outputs: {
|
||||||
properties: {
|
properties: {
|
||||||
success: {
|
success: {
|
||||||
type: "boolean",
|
type: AutomationIOType.BOOLEAN,
|
||||||
description: "Whether the delay was successful",
|
description: "Whether the delay was successful",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -41,8 +41,8 @@ export const definition: AutomationStepSchema = {
|
||||||
description: "Whether the action was successful",
|
description: "Whether the action was successful",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
required: ["success"],
|
||||||
},
|
},
|
||||||
required: ["success"],
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue