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 { default as logger } from "./pino/logger"
|
||||
export { logger, disableLogger } from "./pino/logger"
|
||||
export * from "./alerts"
|
||||
|
||||
// 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 { 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
|
||||
|
||||
const pinoOptions: LoggerOptions = {
|
||||
|
@ -31,6 +42,15 @@ if (env.isDev()) {
|
|||
|
||||
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
|
||||
|
||||
interface MergingObject {
|
||||
|
@ -166,5 +186,3 @@ const getIdentity = () => {
|
|||
}
|
||||
return identity
|
||||
}
|
||||
|
||||
export default logger
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#!/usr/bin/env node
|
||||
import { logging } from "@budibase/backend-core"
|
||||
logging.disableLogger()
|
||||
import "./prebuilds"
|
||||
import "./environment"
|
||||
import { getCommands } from "./options"
|
||||
|
|
|
@ -54,7 +54,7 @@ async function init(opts: PluginOpts) {
|
|||
if (!type || !PLUGIN_TYPE_ARR.includes(type)) {
|
||||
console.log(
|
||||
error(
|
||||
"Please provide a type to init, either 'component' or 'datasource'."
|
||||
"Please provide a type to init, either 'component', 'datasource' or 'automation'."
|
||||
)
|
||||
)
|
||||
return
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import { wait } from "../../utilities"
|
||||
import {
|
||||
AutomationActionStepId,
|
||||
AutomationStepSchema,
|
||||
AutomationIOType,
|
||||
AutomationStepInput,
|
||||
AutomationStepSchema,
|
||||
AutomationStepType,
|
||||
} from "@budibase/types"
|
||||
|
||||
|
@ -18,7 +19,7 @@ export const definition: AutomationStepSchema = {
|
|||
inputs: {
|
||||
properties: {
|
||||
time: {
|
||||
type: "number",
|
||||
type: AutomationIOType.NUMBER,
|
||||
title: "Delay in milliseconds",
|
||||
},
|
||||
},
|
||||
|
@ -27,7 +28,7 @@ export const definition: AutomationStepSchema = {
|
|||
outputs: {
|
||||
properties: {
|
||||
success: {
|
||||
type: "boolean",
|
||||
type: AutomationIOType.BOOLEAN,
|
||||
description: "Whether the delay was successful",
|
||||
},
|
||||
},
|
||||
|
|
|
@ -41,8 +41,8 @@ export const definition: AutomationStepSchema = {
|
|||
description: "Whether the action was successful",
|
||||
},
|
||||
},
|
||||
required: ["success"],
|
||||
},
|
||||
required: ["success"],
|
||||
},
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue