Compare commits
1 Commits
80fbd915ed
...
1d909ac034
Author | SHA1 | Date | |
---|---|---|---|
1d909ac034 |
12
src/index.ts
12
src/index.ts
@ -59,7 +59,7 @@ async function initSonar() {
|
||||
}
|
||||
`
|
||||
);
|
||||
logger.info(`Authenticated to Sonar as '${user.me.name}'.`);
|
||||
logger.info(`Authenticated to Sonar as '${user.me.name}'`);
|
||||
return sonar;
|
||||
}
|
||||
|
||||
@ -88,11 +88,11 @@ async function initRingCentralSDK() {
|
||||
platform.on(platform.events.refreshError, async (err) => {
|
||||
logger.error("Refresh token error:", err);
|
||||
await login();
|
||||
logger.info("RingCentral re-authentication successful.");
|
||||
logger.info("RingCentral re-authentication successful");
|
||||
});
|
||||
|
||||
await login();
|
||||
logger.info("Authenticated to RingCentral.");
|
||||
logger.info("Authenticated to RingCentral");
|
||||
|
||||
return sdk;
|
||||
}
|
||||
@ -101,7 +101,7 @@ async function initDB() {
|
||||
const db = knex(knexConfig);
|
||||
if (!process.env.DB_SKIP_MIGRATIONS) {
|
||||
await db.migrate.latest();
|
||||
logger.info("Database migrations run successfully.");
|
||||
logger.info("Database migrations run successfully");
|
||||
}
|
||||
return db;
|
||||
}
|
||||
@ -114,9 +114,10 @@ async function main() {
|
||||
const rcsdk = await initRingCentralSDK();
|
||||
const db = await initDB();
|
||||
|
||||
logger.info("Starting ticketizer...");
|
||||
const intervals = ticketize(sonar, rcsdk, db, getTicketizeConfig());
|
||||
|
||||
logger.info("Started");
|
||||
|
||||
["SIGINT", "SIGTERM", "SIGQUIT"].forEach((sig) => {
|
||||
process.on(sig, async () => {
|
||||
logger.info(`\nCaught ${sig}, shutting down...`);
|
||||
@ -130,6 +131,7 @@ async function main() {
|
||||
logger.error(result.reason);
|
||||
}
|
||||
});
|
||||
await rcsdk.logout();
|
||||
process.exit(errors ? 1 : 0);
|
||||
});
|
||||
});
|
||||
|
@ -5,7 +5,10 @@ export const DEBUG = !!process.env.DEBUG;
|
||||
export const logger = winston.createLogger({
|
||||
level: DEBUG ? "debug" : process.env.LOG_LEVEL ?? "info",
|
||||
transports: [new winston.transports.Console()],
|
||||
format: format.printf(({ level, message }) => `${level}: ${message}`),
|
||||
format: format.combine(
|
||||
format.errors({ stack: true }),
|
||||
format.printf(({ level, message }) => `${level}: ${message}`)
|
||||
),
|
||||
});
|
||||
|
||||
export function getNationalNumber(input: string) {
|
||||
|
Loading…
Reference in New Issue
Block a user