forked from NotNet/gluestick
make logger a global
This commit is contained in:
parent
967bb2a2d2
commit
da5373ef25
|
@ -2,11 +2,13 @@ import { PrismaClient } from "@prisma/client";
|
|||
import { Client as LDAPClient } from "ldapts";
|
||||
import { ApolloClient, InMemoryCache } from "@apollo/client";
|
||||
import { LLDAPAuthResponse } from "@/ldap";
|
||||
import { Logger } from "pino";
|
||||
|
||||
declare global {
|
||||
var prisma: PrismaClient | undefined;
|
||||
var ldapClient: LDAPClient | undefined;
|
||||
var authResponse: LLDAPAuthResponse | undefined;
|
||||
var logger: Logger;
|
||||
|
||||
namespace NodeJS {
|
||||
interface ProcessEnv {
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
import pino from "pino";
|
||||
|
||||
const logger = pino();
|
||||
if (global.logger == null) {
|
||||
global.logger = pino();
|
||||
}
|
||||
|
||||
export function getLogger(name: string) {
|
||||
return logger.child({ name });
|
||||
return global.logger.child({ name });
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue