Skip to content

Commit

Permalink
0.1.3 - fixes things logging when you dont want them to
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamint08 committed Apr 6, 2024
1 parent 5dfee93 commit 01b4d84
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/instances/mongodb.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
declare class Mongo {
private client;
connect(url: string): Promise<void>;
connect(url: string, log?: boolean): Promise<void>;
getCollection(db: string, col: string): Promise<any>;
getDatabase(db: string): Promise<any>;
update(db: string, col: string, query: any, update: any): Promise<any>;
Expand Down
2 changes: 1 addition & 1 deletion lib/main/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "probun",
"description": "Powerful file-based routing for Bun servers",
"module": "src/main/index.ts",
"version": "0.1.2",
"version": "0.1.3",
"main": "./lib/main/index.js",
"type": "module",
"devDependencies": {
Expand Down
7 changes: 5 additions & 2 deletions src/instances/mongodb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ import chalk from "chalk";
class Mongo {
private client: MongoClient | null = null;

async connect(url: string): Promise<void> {
async connect(url: string, log: boolean = false): Promise<void> {
this.client = new MongoClient(url);
const start = Date.now();
await this.client.connect().then(() => {
console.log(chalk.greenBright("Connected to MongoDB"));
if (log) {
console.log(chalk.bold.whiteBright(`MongoDB connected in `) + chalk.bold.greenBright(`${Date.now() - start}ms`));
}
});
}

Expand Down
Loading

0 comments on commit 01b4d84

Please sign in to comment.