feat(logging): Wave 2 - integrate logging throughout application
This commit integrates the logging infrastructure across the entire application: IPC Layer: - Add logger-handler.ts with centralized IPC logging channels - Integrate audit logging into auth, cleaner, extractor handlers - Add structured logging for IPC operations and data flow Service Layer: - Add logger integration to ERP services (extractor, cleaner) - Integrate logging into excel-parser and user DAO - Add operation tracking and error logging Renderer Layer: - Add useLogger hook for component-level logging - Update App.tsx with session and user activity logging - Enable frontend audit trail for critical actions Testing: - Add comprehensive IPC logging integration tests - Enhance unit test coverage for logger and audit-logger - Add end-to-end logging flow validation Types: - Update preload type definitions for logging APIs Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -13,6 +13,9 @@ import { SqlServerService } from '../database/sql-server'
|
||||
import { ConfigManager } from '../config/config-manager'
|
||||
import sql from 'mssql'
|
||||
import type { UserInfo } from '../../types/user.types'
|
||||
import { createLogger } from '../logger'
|
||||
|
||||
const log = createLogger('BipUsersDao')
|
||||
|
||||
/**
|
||||
* Database configuration for BIPUsers table
|
||||
@@ -160,7 +163,7 @@ export class BIPUsersDAO {
|
||||
return null
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('[BIPUsersDAO] Authenticate error:', error)
|
||||
log.error('Authenticate error:', error)
|
||||
return null
|
||||
}
|
||||
}
|
||||
@@ -215,7 +218,7 @@ export class BIPUsersDAO {
|
||||
return null
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('[BIPUsersDAO] Authenticate by computer name error:', error)
|
||||
log.error('Authenticate by computer name error:', error)
|
||||
return null
|
||||
}
|
||||
}
|
||||
@@ -247,7 +250,7 @@ export class BIPUsersDAO {
|
||||
createTime: row.CreateTime as Date | undefined
|
||||
}))
|
||||
} catch (error) {
|
||||
console.error('[BIPUsersDAO] Get all users error:', error)
|
||||
log.error('Get all users error:', error)
|
||||
return []
|
||||
}
|
||||
}
|
||||
@@ -331,7 +334,7 @@ export class BIPUsersDAO {
|
||||
return true
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('[BIPUsersDAO] Create user error:', error)
|
||||
log.error('Create user error:', error)
|
||||
return false
|
||||
}
|
||||
}
|
||||
@@ -370,7 +373,7 @@ export class BIPUsersDAO {
|
||||
return true
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('[BIPUsersDAO] Update user type error:', error)
|
||||
log.error('Update user type error:', error)
|
||||
return false
|
||||
}
|
||||
}
|
||||
@@ -409,7 +412,7 @@ export class BIPUsersDAO {
|
||||
return true
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('[BIPUsersDAO] Update password error:', error)
|
||||
log.error('Update password error:', error)
|
||||
return false
|
||||
}
|
||||
}
|
||||
@@ -444,7 +447,7 @@ export class BIPUsersDAO {
|
||||
return true
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('[BIPUsersDAO] Delete user error:', error)
|
||||
log.error('Delete user error:', error)
|
||||
return false
|
||||
}
|
||||
}
|
||||
@@ -481,7 +484,7 @@ export class BIPUsersDAO {
|
||||
return result.rows.length > 0 && (result.rows[0].count as number) > 0
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('[BIPUsersDAO] User exists error:', error)
|
||||
log.error('User exists error:', error)
|
||||
return false
|
||||
}
|
||||
}
|
||||
@@ -538,7 +541,7 @@ export class BIPUsersDAO {
|
||||
return null
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('[BIPUsersDAO] Get user ERP credentials error:', error)
|
||||
log.error('Get user ERP credentials error:', error)
|
||||
return null
|
||||
}
|
||||
}
|
||||
@@ -586,7 +589,7 @@ export class BIPUsersDAO {
|
||||
return true
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('[BIPUsersDAO] Update user ERP credentials error:', error)
|
||||
log.error('Update user ERP credentials error:', error)
|
||||
return false
|
||||
}
|
||||
}
|
||||
@@ -624,7 +627,7 @@ export class BIPUsersDAO {
|
||||
erpUsername: (row[cols.ERP_USERNAME] as string) || ''
|
||||
}))
|
||||
} catch (error) {
|
||||
console.error('[BIPUsersDAO] Get all users ERP config error:', error)
|
||||
log.error('Get all users ERP config error:', error)
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user