mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
wip: removing console log
This commit is contained in:
1 parent
515aefcadc
commit
82d1004ecf
16 files changed
+57
-34
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import Docker from 'dockerode'
|
||||
import config, { getQuestImage } from '../config.js'
|
||||
import logger from '../utils/logger.js'
|
||||
|
||||
const engine = new Docker()
|
||||
|
||||
@@ -33,7 +34,7 @@ export function createContainer(name, questId) {
|
||||
}
|
||||
|
||||
export async function getAndStartContainer(id) {
|
||||
console.log(`Getting container: ${id}`)
|
||||
logger.debug(`Getting container: ${id}`)
|
||||
const container = engine.getContainer(id)
|
||||
if (!container) {
|
||||
throw new Error(`Container ${id} not found`)
|
||||
@@ -74,7 +75,7 @@ export async function deleteContainer(id) {
|
||||
try {
|
||||
await container.stop()
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
logger.warn(error)
|
||||
}
|
||||
await container.remove()
|
||||
}
|
||||
@@ -99,21 +100,21 @@ export function buildQuestImage(questPath, questId) {
|
||||
// Process the data (this could be Docker build output)
|
||||
const { stream, error } = JSON.parse(data.toString())
|
||||
if (stream) {
|
||||
console.log(stream)
|
||||
logger.info(stream)
|
||||
}
|
||||
if (error) {
|
||||
console.error(error)
|
||||
logger.error(error)
|
||||
reject(error)
|
||||
}
|
||||
})
|
||||
|
||||
response.on('end', () => {
|
||||
console.log(`Build completed for ${questId}`)
|
||||
logger.info(`Build completed for ${questId}`)
|
||||
resolve(questId)
|
||||
})
|
||||
|
||||
response.on('error', (error) => {
|
||||
console.error(`Build failed for ${questId}:`, error)
|
||||
logger.error(`Build failed for ${questId}:`, error)
|
||||
reject(error)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user