@live-change/framework
Advanced tools
Comparing version 0.4.40 to 0.4.41
@@ -68,3 +68,2 @@ const crypto = require("crypto") | ||
] | ||
this.defaultPath = "." | ||
const dbDao = new ReactiveDao(process.cwd()+' '+process.argv.join(' '), { | ||
@@ -71,0 +70,0 @@ remoteUrl: env.DB_URL || "http://localhost:9417/api/ws", |
@@ -1,38 +0,8 @@ | ||
const fs = require('fs') | ||
const os = require('os') | ||
const { once } = require('events') | ||
class ProfileLog { | ||
constructor(path) { | ||
this.profileLogStream = null | ||
this.profileLogStreamDrainPromise = null | ||
if(process.env.PROFILE_LOG_PATH) { | ||
const dateString = new Date().toISOString().slice(0, -1).replace(/[T:\\.-]/gi, '_') | ||
const serviceName = process.cwd().split('/').pop() | ||
const hostname = os.hostname() | ||
const username = os.userInfo().username | ||
const logPath = process.env.PROFILE_LOG_PATH + serviceName + | ||
'@' + username + '@' + hostname + '@' + dateString + '.prof.log' | ||
this.profileLogStream = fs.createWriteStream(logPath) | ||
} | ||
if(path) { | ||
this.profileLogStream = fs.createWriteStream(path) | ||
} | ||
constructor() { | ||
this.writers = [] | ||
} | ||
async log(operation) { | ||
if(!this.profileLogStream) return; | ||
const msg = { | ||
time: (new Date()).toISOString(), | ||
...operation | ||
} | ||
if(!this.profileLogStream.write(JSON.stringify(msg)+'\n')) { | ||
if(!this.profileLogStreamDrainPromise) { | ||
this.profileLogStreamDrainPromise = once(this.profileLogStream, 'drain') | ||
} | ||
await this.profileLogStreamDrainPromise | ||
this.profileLogStreamDrainPromise = null | ||
} | ||
await Promise.all(this.writers.map(writer => writer.write(operation))) | ||
} | ||
@@ -39,0 +9,0 @@ |
{ | ||
"name": "@live-change/framework", | ||
"version": "0.4.40", | ||
"version": "0.4.41", | ||
"description": "Live Change Framework - ultimate solution for real time mobile/web apps", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
172615
60
4673