Skip to content

Commit

Permalink
refactor: reduce logging severity (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjastrzebski authored Dec 16, 2024
1 parent 122dfd2 commit d6b3e3a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
6 changes: 6 additions & 0 deletions .changeset/lemon-coats-fry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@callstack/byorg-utils': patch
'@callstack/byorg-core': patch
---

core: reduce some of the startup logs severity to debug
2 changes: 1 addition & 1 deletion examples/discord/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ void (async () => {
await discord.login(DISCORD_BOT_TOKEN);
logger.info('Discord ready.');
} catch (error) {
logger.error('Dev Slack start error:', error);
logger.error('Dev Discord start error:', error);
}
})();
4 changes: 2 additions & 2 deletions packages/core/src/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function createApp(config: ApplicationConfig): Application {
const { plugins = [], chatModel, errorHandler = defaultErrorHandler } = config;

plugins.forEach((plugin) => {
logger.info(`Plugin "${plugin.name}" registered`);
logger.debug(`Plugin "${plugin.name}" registered`);
});

const middlewares: Middleware[] = [
Expand All @@ -68,7 +68,7 @@ export function createApp(config: ApplicationConfig): Application {

// TODO: Validate
tools.forEach((tool) => {
logger.info(`Tool "${tool.name}" registered`);
logger.debug(`Tool "${tool.name}" registered`);
});

const middlewareExecutor = new MiddlewareHandler();
Expand Down
5 changes: 1 addition & 4 deletions packages/utils/src/env.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import * as logger from './logger/logger.js';

export function requireEnv(key: string) {
const value = process.env[key];
if (!value) {
logger.error(`Missing environment variable: ${key}`);
process.exit(1);
throw new Error(`Missing environment variable: ${key}`);
}

return value;
Expand Down

0 comments on commit d6b3e3a

Please sign in to comment.