fix(all): New templates.
This commit is contained in:
parent
56ce112479
commit
54fafdf0e8
4 changed files with 11 additions and 31 deletions
|
@ -491,7 +491,7 @@ export class KeywordsExpressions {
|
|||
keywords[i++] = [
|
||||
/^\s*(DEBUG)(\s*)(.*)/gim,
|
||||
($0, $1, $2, $3) => {
|
||||
const params = this.getParams($3, ['text']);
|
||||
const params = this.getParams($3, ['obj']);
|
||||
return `await sys.log ({pid: pid, ${params}})`;
|
||||
}
|
||||
];
|
||||
|
|
|
@ -770,7 +770,7 @@ export class SystemKeywords {
|
|||
rowsDest.push(dst);
|
||||
dst = null;
|
||||
});
|
||||
GBLogEx.info(min, `SAVE '${table}': ${rows.length} row(s). ${GBUtil.toYAML(rowsDest)}`);
|
||||
GBLogEx.info(min, `SAVE '${table}': ${rows.length} row(s).`);
|
||||
|
||||
await retry(
|
||||
async bail => {
|
||||
|
@ -2698,34 +2698,9 @@ export class SystemKeywords {
|
|||
return array;
|
||||
}
|
||||
|
||||
public async log({ pid, text: obj }) {
|
||||
public async log({ pid, obj }) {
|
||||
const { min } = await DialogKeywords.getProcessInfo(pid);
|
||||
|
||||
let level = 0;
|
||||
const mydump = (text, level) => {
|
||||
var dumped_text = '';
|
||||
|
||||
var level_padding = '';
|
||||
for (var j = 0; j < level + 1; j++) level_padding += ' ';
|
||||
|
||||
if (typeof text == 'object') {
|
||||
for (var item in text) {
|
||||
var value = text[item];
|
||||
|
||||
if (typeof value == 'object') {
|
||||
dumped_text += level_padding + "'" + item + "' ...\n";
|
||||
dumped_text += mydump(value, level + 1);
|
||||
} else {
|
||||
dumped_text += level_padding + "'" + item + '\' => "' + value + '"\n';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dumped_text = text + '(' + typeof text + ')';
|
||||
}
|
||||
return dumped_text;
|
||||
};
|
||||
|
||||
GBLogEx.info(min, mydump(obj, level));
|
||||
GBLogEx.info(min, GBUtil.toYAML(obj));
|
||||
}
|
||||
|
||||
public async getPdf({ pid, file }) {
|
||||
|
|
|
@ -105,9 +105,13 @@ export class GBConfigService {
|
|||
case 'MARKETPLACE_ID':
|
||||
value = undefined;
|
||||
break;
|
||||
case 'MARKETPLACE_SECRET':
|
||||
case 'LOG_ON_STORAGE':
|
||||
value = false;
|
||||
break;
|
||||
case 'MARKETPLACE_SECRET':
|
||||
value = undefined;
|
||||
break;
|
||||
|
||||
case 'STORAGE_DIALECT':
|
||||
value = 'sqlite';
|
||||
break;
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
import { GBLog, IGBInstance } from 'botlib';
|
||||
import { GuaribasLog } from '../models/GBModel.js';
|
||||
import { GBServer } from '../../../src/app.js';
|
||||
import { GBConfigService } from './GBConfigService.js';
|
||||
|
||||
export class GBLogEx {
|
||||
public static async error(minOrInstanceId: any, message: string) {
|
||||
|
@ -76,7 +77,7 @@ export class GBLogEx {
|
|||
* Finds and update user agent information to a next available person.
|
||||
*/
|
||||
public static async log(instance: IGBInstance, kind: string, message: string): Promise<GuaribasLog> {
|
||||
if (process.env.LOG_ON_STORAGE) {
|
||||
if (GBConfigService.get('LOG_ON_STORAGE')) {
|
||||
message = message ? message.substring(0, 1023) : null;
|
||||
|
||||
return await GuaribasLog.create(<GuaribasLog>{
|
||||
|
|
Loading…
Add table
Reference in a new issue