@gratheon/log-lib 2.2.5 → 2.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/logger.js +5 -1
- package/package.json +1 -1
- package/src/logger.ts +4 -1
package/dist/logger.js
CHANGED
|
@@ -107,7 +107,7 @@ async function initializeConnection(config) {
|
|
|
107
107
|
INDEX idx_level (level)
|
|
108
108
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
109
109
|
`);
|
|
110
|
-
// Run migrations: Add stacktrace column if it doesn't exist (for existing tables)
|
|
110
|
+
// Run migrations: Add stacktrace column if it doesn't exist (for existing tables created before v2.2.0)
|
|
111
111
|
try {
|
|
112
112
|
const columns = await conn.query((0, mysql_1.sql) `SHOW COLUMNS FROM \`logs\` LIKE 'stacktrace'`);
|
|
113
113
|
if (columns.length === 0) {
|
|
@@ -115,12 +115,16 @@ async function initializeConnection(config) {
|
|
|
115
115
|
await conn.query((0, mysql_1.sql) `ALTER TABLE \`logs\` ADD COLUMN \`stacktrace\` TEXT AFTER \`meta\``);
|
|
116
116
|
console.log('[log-lib] Migration complete: stacktrace column added');
|
|
117
117
|
}
|
|
118
|
+
else {
|
|
119
|
+
console.log('[log-lib] Migration check: stacktrace column already exists');
|
|
120
|
+
}
|
|
118
121
|
}
|
|
119
122
|
catch (migrationErr) {
|
|
120
123
|
console.error('[log-lib] Migration failed (non-critical):', migrationErr);
|
|
121
124
|
// Don't fail initialization if migration fails
|
|
122
125
|
}
|
|
123
126
|
dbInitialized = true;
|
|
127
|
+
console.log('[log-lib] Database initialization complete');
|
|
124
128
|
}
|
|
125
129
|
catch (err) {
|
|
126
130
|
console.error('Failed to initialize logs database:', err);
|
package/package.json
CHANGED
package/src/logger.ts
CHANGED
|
@@ -91,13 +91,15 @@ async function initializeConnection(config: LoggerConfig) {
|
|
|
91
91
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
92
92
|
`);
|
|
93
93
|
|
|
94
|
-
// Run migrations: Add stacktrace column if it doesn't exist (for existing tables)
|
|
94
|
+
// Run migrations: Add stacktrace column if it doesn't exist (for existing tables created before v2.2.0)
|
|
95
95
|
try {
|
|
96
96
|
const columns = await conn.query(sql`SHOW COLUMNS FROM \`logs\` LIKE 'stacktrace'`);
|
|
97
97
|
if (columns.length === 0) {
|
|
98
98
|
console.log('[log-lib] Running migration: Adding stacktrace column...');
|
|
99
99
|
await conn.query(sql`ALTER TABLE \`logs\` ADD COLUMN \`stacktrace\` TEXT AFTER \`meta\``);
|
|
100
100
|
console.log('[log-lib] Migration complete: stacktrace column added');
|
|
101
|
+
} else {
|
|
102
|
+
console.log('[log-lib] Migration check: stacktrace column already exists');
|
|
101
103
|
}
|
|
102
104
|
} catch (migrationErr) {
|
|
103
105
|
console.error('[log-lib] Migration failed (non-critical):', migrationErr);
|
|
@@ -105,6 +107,7 @@ async function initializeConnection(config: LoggerConfig) {
|
|
|
105
107
|
}
|
|
106
108
|
|
|
107
109
|
dbInitialized = true;
|
|
110
|
+
console.log('[log-lib] Database initialization complete');
|
|
108
111
|
} catch (err) {
|
|
109
112
|
console.error('Failed to initialize logs database:', err);
|
|
110
113
|
// Don't throw - allow the service to start even if logging DB fails
|