mirror of
https://gitlab.silvrtree.co.uk/martind2000/nci.git
synced 2025-02-19 02:39:15 +00:00
unified log lines format
This commit is contained in:
parent
bc609373ac
commit
18d4100e82
@ -60,7 +60,7 @@ exports.init = function(app, callback) {
|
|||||||
.on('readable', function() {
|
.on('readable', function() {
|
||||||
var data = stream.read();
|
var data = stream.read();
|
||||||
while (data) {
|
while (data) {
|
||||||
client.emit('sync', 'data', data);
|
client.emit('sync', 'data', {lines: [{text: data}]});
|
||||||
data = stream.read();
|
data = stream.read();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -109,6 +109,13 @@ exports.init = function(app, callback) {
|
|||||||
data += '\n';
|
data += '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (buildLogLineNumbersHash[build.id]) {
|
||||||
|
buildLogLineNumbersHash[build.id]++;
|
||||||
|
} else {
|
||||||
|
buildLogLineNumbersHash[build.id] = 1;
|
||||||
|
}
|
||||||
|
var logLineNumber = buildLogLineNumbersHash[build.id];
|
||||||
|
|
||||||
var filePath = getBuildLogPath(build.id);
|
var filePath = getBuildLogPath(build.id);
|
||||||
|
|
||||||
if (!writeStreamsHash[filePath]) {
|
if (!writeStreamsHash[filePath]) {
|
||||||
@ -126,17 +133,11 @@ exports.init = function(app, callback) {
|
|||||||
writeStreamsHash[filePath].write(data);
|
writeStreamsHash[filePath].write(data);
|
||||||
|
|
||||||
app.dataio.resource('build' + build.id).clientEmitSync(
|
app.dataio.resource('build' + build.id).clientEmitSync(
|
||||||
'data', data
|
'data',
|
||||||
|
{lines: [{number: logLineNumber, text: data}]}
|
||||||
);
|
);
|
||||||
|
|
||||||
// write build logs to db
|
// write build logs to db
|
||||||
if (buildLogLineNumbersHash[build.id]) {
|
|
||||||
buildLogLineNumbersHash[build.id]++;
|
|
||||||
} else {
|
|
||||||
buildLogLineNumbersHash[build.id] = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
var logLineNumber = buildLogLineNumbersHash[build.id];
|
|
||||||
|
|
||||||
db.logLines.put({
|
db.logLines.put({
|
||||||
buildId: build.id,
|
buildId: build.id,
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
define([
|
define([
|
||||||
'underscore',
|
'underscore', 'reflux', 'app/actions/build', 'app/connect'
|
||||||
'reflux', 'app/actions/build', 'app/connect'
|
], function(
|
||||||
], function(_, Reflux, BuildActions, connect) {
|
_, Reflux, BuildActions, connect
|
||||||
|
) {
|
||||||
var Store = Reflux.createStore({
|
var Store = Reflux.createStore({
|
||||||
listenables: BuildActions,
|
listenables: BuildActions,
|
||||||
|
|
||||||
@ -28,7 +29,7 @@ define([
|
|||||||
}
|
}
|
||||||
|
|
||||||
connect.resource(resourceName).subscribe('data', function(data) {
|
connect.resource(resourceName).subscribe('data', function(data) {
|
||||||
output += data;
|
output += _(data.lines).pluck('text').join('');
|
||||||
|
|
||||||
self.trigger({
|
self.trigger({
|
||||||
buildId: build.id,
|
buildId: build.id,
|
||||||
|
Loading…
Reference in New Issue
Block a user