I have a logs that are displaying to client live using socket.io
now there is requirement where user can record logs according to their requirement in particular,so i want user to have ability to get logs using socket.io
and log into file so it should start recording when user click on record and stop recording and save when user click on stop.How can we append data to file that is being listen on socket.io
?
main.html
<div class="col-md-9" style="height: 600px; width: 1000px; overflow: scroll">
<ul>
<li ng-repeat="message in event track by $index">{{message}}</li>
</ul>
</div>
<button type="button" class="btn btn-success" ng-click="recordLogs()"><a href="" id="a">record</a></button>
<button type="button" class="btn btn-success" ng-click="stopLogs()">stop</button>
ctrl.js
$scope.event = [];
socket.on('ditConsumer', function(data) {
$scope.event.push(data);
});
Here once user click on recordLogs()
i want to create a file and start logging messages that are coming after invoking recordLogs()
to a file.
$scope.recordLogs = function() {
//create a file and start logging from this point to a file
}
server.js
io.sockets.on('connection',function(){
// Producer.startProducer();
ditconsumer.start(function(value){
io.emit('ditConsumer',value)
});
});