parametros
This commit is contained in:
parent
38849c8a1d
commit
257ac91394
5 changed files with 47 additions and 11 deletions
|
|
@ -31,6 +31,7 @@ type tipoLevel = "info" | "warn" | "error"
|
|||
type tipoOpSessao = {
|
||||
inquilino: string
|
||||
usuario: string
|
||||
parametros?: { [k: string]: string }
|
||||
}
|
||||
|
||||
type tipoLog = {
|
||||
|
|
@ -41,14 +42,27 @@ type tipoLog = {
|
|||
}
|
||||
|
||||
export const logger =
|
||||
({ app: app_e, eProducao }: { app: string; eProducao: boolean }) =>
|
||||
({ inquilino, usuario }: tipoOpSessao) =>
|
||||
({
|
||||
app: app_e,
|
||||
eProducao,
|
||||
parametros: parametrosAmbiente,
|
||||
}: {
|
||||
app: string
|
||||
eProducao: boolean
|
||||
parametros?: { [k: string]: string }
|
||||
}) =>
|
||||
({ inquilino, usuario, parametros: parametrosSessao }: tipoOpSessao) =>
|
||||
async (
|
||||
level: tipoLevel,
|
||||
mensagem: string,
|
||||
op_tipoLog?: tipoLog,
|
||||
): Promise<[objeto: object, erro?: string]> => {
|
||||
let { __filename, detalhes, local, parametros } = op_tipoLog || {}
|
||||
let {
|
||||
__filename,
|
||||
detalhes,
|
||||
local,
|
||||
parametros: parametrosLog,
|
||||
} = op_tipoLog || {}
|
||||
|
||||
const app = `${eProducao ? "" : "DEV-"}${app_e}`
|
||||
|
||||
|
|
@ -71,7 +85,15 @@ export const logger =
|
|||
: mensagem
|
||||
|
||||
const payload = {
|
||||
stream: { app, inquilino, usuario, level, ...(parametros || {}) },
|
||||
stream: {
|
||||
app,
|
||||
inquilino,
|
||||
usuario,
|
||||
level,
|
||||
...(parametrosAmbiente || {}),
|
||||
...(parametrosSessao || {}),
|
||||
...(parametrosLog || {}),
|
||||
},
|
||||
values: [
|
||||
[
|
||||
timestamp,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue