Commit 20c9e59
feat: migrate logging system from custom transports to Winston
## Summary
Migrated Levante's custom logging system (420 lines) to Winston logger while maintaining 100% backward compatibility and zero overhead for disabled categories.
## Key Changes
### New Files
- `src/main/services/logging/winstonConfig.ts` - Winston transport configuration
- `src/main/services/logging/timezoneFormat.ts` - Timezone support (extracted from transports.ts)
- `docs/testing/winston-migration-testing.md` - Comprehensive testing guide
- `scripts/test-winston-logging.ts` - Automated testing script
### Modified Files
- `src/main/services/logging/logger.ts` - Replaced custom transports with Winston logger
- `src/main/services/logging/config.ts` - Added production/development defaults
- `src/main/services/logging/index.ts` - Updated exports
- `package.json` - Added winston-daily-rotate-file dependency
### Removed Files
- `src/main/services/logging/transports.ts` - Replaced by Winston transports (420 lines removed)
## Features
### Production vs Development
**Development** (NODE_ENV=development):
- Console output with colors
- Debug level logging
- Verbose categories enabled (ai-sdk, mcp, database, oauth)
- Single file: levante-YYYY-MM-DD-HHmmss.log
- Rotation: 10MB, 3 files, 7 days
**Production** (NODE_ENV=production):
- No console output (file only)
- Warn level logging
- Verbose categories disabled
- Two files: all logs + error-only log
- Rotation: 50MB, 10 files, 30 days
- Gzip compression enabled
### Preserved Features
✅ Zero overhead for disabled categories
✅ 9 categories (ai-sdk, mcp, database, ipc, preferences, models, core, analytics, oauth)
✅ Environment variable configuration
✅ Timezone support
✅ IPC bridge (renderer → main)
✅ Same public API (no breaking changes)
### New Capabilities
✨ Structured JSON logs (production)
✨ Separate error log file (production)
✨ Battle-tested Winston transports
✨ Automatic gzip compression
✨ Winston audit files for rotation tracking
✨ Foundation for future log viewer UI
## Code Impact
- Lines added: ~350
- Lines removed: ~420
- Net reduction: ~70 lines
- Breaking changes: 0
## Documentation
- Updated `docs/LOGGING.md` with "Arquitectura Winston" section
- Updated `CLAUDE.md` logging section
- Added comprehensive testing guide
## Testing
- ✅ Typecheck passes
- ✅ Zero overhead verified
- ✅ Backward compatible API
- Manual testing required per testing guide
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent 27d4b28 commit 20c9e59
File tree
12 files changed
+944
-654
lines changed- docs
- testing
- scripts
- src/main/services/logging
12 files changed
+944
-654
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
288 | | - | |
| 288 | + | |
289 | 289 | | |
290 | | - | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
291 | 296 | | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
330 | 300 | | |
331 | | - | |
| 301 | + | |
332 | 302 | | |
333 | 303 | | |
334 | 304 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
| 120 | + | |
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
128 | 254 | | |
129 | 255 | | |
130 | 256 | | |
| |||
0 commit comments