Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Enhancement suggestions are tracked as GitHub issues. When creating an enhanceme
## Development Process

1. **Set up your development environment:**

```bash
git clone https://github.com/YOUR_USERNAME/data-pup.git
cd data-pup
Expand All @@ -56,6 +57,7 @@ Enhancement suggestions are tracked as GitHub issues. When creating an enhanceme
- Update documentation as needed

3. **Test your changes:**

```bash
npm run build
npm run preview
Expand All @@ -66,6 +68,18 @@ Enhancement suggestions are tracked as GitHub issues. When creating an enhanceme
- Include the relevant issue number if applicable
- Screenshots/GIFs for UI changes are helpful

## Logging Usage

This project uses [electron-log](https://github.com/megahertz/electron-log) for logging purposes.

The logger is initialized in `src/main/utils/logger.ts`

The logs are written to the following file locations:

- **on Linux** : `~/.config/DataPup/logs/[YYYY-MM-DD].log`
- **on macOS** : `~/Library/Logs/DataPup/[YYYY-MM-DD].log`
- **on Windows** : `%USERPROFILE%\AppData\Roaming\DataPup\logs\[YYYY-MM-DD].log`

## Style Guide

### Git Commit Messages
Expand Down Expand Up @@ -119,4 +133,4 @@ By contributing, you agree that your contributions will be licensed under the MI

---

Thank you for contributing to Data-Pup! 🐶✨
Thank you for contributing to Data-Pup! 🐶✨
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
"@types/react-syntax-highlighter": "^15.5.13",
"@types/uuid": "^10.0.0",
"better-sqlite3": "^12.2.0",
"electron-log": "^5.4.2",
"framer-motion": "^12.23.0",
"langchain": "^0.3.30",
"monaco-editor": "^0.52.2",
Expand Down
30 changes: 15 additions & 15 deletions src/main/database/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
TableQueryOptions
} from './interface'
import { DatabaseManagerFactory } from './factory'

import { logger } from '../utils/logger'
class DatabaseManager {
private factory: DatabaseManagerFactory
private activeConnection: { id: string; type: string; manager: DatabaseManagerInterface } | null =
Expand Down Expand Up @@ -62,7 +62,7 @@ class DatabaseManager {

return result
} catch (error) {
console.error('Database test connection error:', error)
logger.error('Database test connection error:', error)
return {
success: false,
message: 'Failed to test connection',
Expand Down Expand Up @@ -111,7 +111,7 @@ class DatabaseManager {

return result
} catch (error) {
console.error('Database connection error:', error)
logger.error('Database connection error:', error)
return {
success: false,
message: 'Failed to connect to database',
Expand All @@ -136,7 +136,7 @@ class DatabaseManager {

return result
} catch (error) {
console.error('Database disconnection error:', error)
logger.error('Database disconnection error:', error)
return {
success: false,
message: 'Failed to disconnect from database'
Expand All @@ -157,7 +157,7 @@ class DatabaseManager {
// Execute query using the specific manager
return await this.activeConnection.manager.query(connectionId, sql, sessionId)
} catch (error) {
console.error('Database query error:', error)
logger.error('Database query error:', error)
return {
success: false,
message: 'Query execution failed',
Expand All @@ -180,7 +180,7 @@ class DatabaseManager {

return await this.activeConnection.manager.cancelQuery(connectionId, queryId)
} catch (error) {
console.error('Query cancellation error:', error)
logger.error('Query cancellation error:', error)
return {
success: false,
message: error instanceof Error ? error.message : 'Failed to cancel query'
Expand All @@ -204,7 +204,7 @@ class DatabaseManager {

return await this.activeConnection.manager.queryTable(connectionId, options, sessionId)
} catch (error) {
console.error('Table query error:', error)
logger.error('Table query error:', error)
return {
success: false,
message: 'Table query execution failed',
Expand All @@ -226,7 +226,7 @@ class DatabaseManager {

return await this.activeConnection.manager.getDatabases(connectionId)
} catch (error) {
console.error('Error getting databases:', error)
logger.error('Error getting databases:', error)
return {
success: false,
message: 'Failed to get databases'
Expand All @@ -248,7 +248,7 @@ class DatabaseManager {

return await this.activeConnection.manager.getTables(connectionId, database)
} catch (error) {
console.error('Error getting tables:', error)
logger.error('Error getting tables:', error)
return {
success: false,
message: 'Failed to get tables'
Expand All @@ -271,7 +271,7 @@ class DatabaseManager {

return await this.activeConnection.manager.getTableSchema(connectionId, tableName, database)
} catch (error) {
console.error('Error getting table schema:', error)
logger.error('Error getting table schema:', error)
return {
success: false,
message: 'Failed to get table schema'
Expand Down Expand Up @@ -317,7 +317,7 @@ class DatabaseManager {
const connections = manager.getAllConnections()
allConnections.push(...connections)
} catch (error) {
console.error(`Error getting connections from ${dbType} manager:`, error)
logger.error(`Error getting connections from ${dbType} manager:`, error)
}
}
}
Expand Down Expand Up @@ -362,7 +362,7 @@ class DatabaseManager {

return await this.activeConnection.manager.insertRow(connectionId, table, data, database)
} catch (error) {
console.error('Insert error:', error)
logger.error('Insert error:', error)
return {
success: false,
message: 'Insert operation failed',
Expand Down Expand Up @@ -396,7 +396,7 @@ class DatabaseManager {
database
)
} catch (error) {
console.error('Update error:', error)
logger.error('Update error:', error)
return {
success: false,
message: 'Update operation failed',
Expand Down Expand Up @@ -429,7 +429,7 @@ class DatabaseManager {
database
)
} catch (error) {
console.error('Delete error:', error)
logger.error('Delete error:', error)
return {
success: false,
message: 'Delete operation failed',
Expand Down Expand Up @@ -458,7 +458,7 @@ class DatabaseManager {
database
)
} catch (error) {
console.error('Get table full schema error:', error)
logger.error('Get table full schema error:', error)
return {
success: false,
message: error instanceof Error ? error.message : 'Failed to get table schema'
Expand Down
Loading