Skip to content

Commit

Permalink
ar(feat) flow:reduce-logs
Browse files Browse the repository at this point in the history
  • Loading branch information
angeloreale committed Feb 6, 2024
1 parent bdc89ea commit edb39fd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions lib/model/interfaces/mdb-get-interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export const getUserMeta = async ({

}
const NexusDB = await loadDb()
console.log("@@@@ get iface @@@@", {NexusDB, loadDb})
if(!NexusDB) await patience(3000)
console.log("@@@@ get iface @@@@", {NexusDB})
if(!NexusDB) return

Expand Down
14 changes: 7 additions & 7 deletions lib/model/interfaces/mdb-init-interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ export const oplog: ILogger = [] as unknown as ILogger;
const messageState: ILogContext = {};

messageState.get = () => {
console.log("@@@ getting current message @@@")
// console.log("@@@ getting current message @@@")
return messageState
};

oplog._ = {}
oplog._.queue = []

oplog._.decorateLog = ({ type, action, verb, status, message, priority }) => {
console.log("@@@ decorating log @@@")
// console.log("@@@ decorating log @@@")
const statusMessage: ILogContext = {
type: type || "mongodb",
action: action || messageState.get().action,
Expand All @@ -64,7 +64,7 @@ oplog._.decorateLog = ({ type, action, verb, status, message, priority }) => {
_id: uuid(),
};

console.log("@@@ decorated log @@@", { statusMessage })
// console.log("@@@ decorated log @@@", { statusMessage })

return statusMessage
}
Expand All @@ -82,7 +82,7 @@ oplog._.addToQueue = (payload: ILogContext) => {

oplog._.inform = (payload) => {
if (!process.env.ENABLE_LOG === "true")
if (!Object.isObject(payload) && process.env.LOG_DEPTH === payload) {
if (!Object.isObject(payload) && process.env.LOG_DEPTH == "1") {
messageState.status = status || messageState.get().status
console.log("@@@ oplog informing @@@", payload)
} else {
Expand All @@ -93,7 +93,7 @@ oplog._.inform = (payload) => {
messageState.message = message || messageState.get().message;
}

console.log({ messageState })
// console.log({ messageState })

const log = oplog._.decorateLog(messageState)

Expand Down Expand Up @@ -180,7 +180,7 @@ oplog._.safeAction = async (payload: ILogContext, func: any, options: ILogSafeAc
messageState.message = `[${verb}]:execution-context:starting`
oplog._.inform();
//const result = await func();
console.log("@@@@ opresult @@@@", verb, { func })
// console.log("@@@@ opresult @@@@", verb, { func })


messageState.status = "done"
Expand Down Expand Up @@ -311,7 +311,7 @@ const _init: any = {}
const init = async ({ name }) => {
messageState.action = `init:${name}:nexus`
messageState.verb = "define"
console.log(" @@@ booting up @@@@ ", { _init })
// console.log(" @@@ booting up @@@@ ", { _init })
return await oplog._.safeAction(
{
verb: "initiating NexusDB",
Expand Down

0 comments on commit edb39fd

Please sign in to comment.