How do you enable logging in Lex pool?



  • @Lexicon , @tross

    I can't get the logging function to work??

    Any Ideas?

    My package .json

    {
    "name": "burst-pool",
    "version": "0.0.1",
    "private": true,
    "scripts": {
    "start": "node burst-pool.js"
    },
    "dependencies": {
    "debug" : "",
    "prettyjson" : "
    ",
    "async" : "",
    "http-proxy" : "
    ",
    "request" : "",
    "json-markup" : "
    ",
    "socket.io" : "",
    "express" : "4.x",
    "compression" : "
    ",
    "moment" : "",
    "body-parser" : "
    "

    My pool-logger.js

    var fs = require('fs');

    var enabled = true;
    var toConsole = true;
    var toFile = true;
    var toGeneralFile = true;
    var generalLogFilename = 'test.txt';

    function TimeStamp() {
    var date = new Date();
    var hour = date.getHours();
    hour = (hour < 10 ? "0" : "") + hour;
    var min = date.getMinutes();
    min = (min < 10 ? "0" : "") + min;
    var sec = date.getSeconds();
    sec = (sec < 10 ? "0" : "") + sec;
    var year = date.getFullYear();
    var month = date.getMonth() + 1;
    month = (month < 10 ? "0" : "") + month;
    var day = date.getDate();
    day = (day < 10 ? "0" : "") + day;
    return year + "-" + month + "-" + day + "_" + hour + "-" + min + "-" + sec;
    }
    function TimeStampFile() {
    var date = new Date();
    var hour = date.getHours();
    hour = (hour < 10 ? "0" : "") + hour;
    var min = date.getMinutes();
    min = (min < 10 ? "0" : "") + min;
    var sec = date.getSeconds();
    sec = (sec < 10 ? "0" : "") + sec;
    var year = date.getFullYear();
    var month = date.getMonth() + 1;
    month = (month < 10 ? "0" : "") + month;
    var day = date.getDate();
    day = (day < 10 ? "0" : "") + day;
    return day+ "-" + month + "-" + year;
    }

    function write(name,text){
    if (enabled){
    if (toFile){
    fs.appendFile('log_'+name+'.txt', TimeStamp()+' '+text+'\n', function (err) {
    if (err) throw err;
    });
    }
    if (toGeneralFile){
    fs.appendFile(generalLogFilename, TimeStamp()+' ('+name+') '+text+'\n', function (err) {
    if (err) throw err;
    });
    }
    if (toConsole){
    console.log('(logger.'+name+") "+text)
    }
    }
    }
    function writeDateLog(text){
    if (enabled){

    		if (toFile){
    		fs.exists('./Logs/log_'+TimeStampFile()+'.txt', function(exists) {
              if (exists) {
                	fs.appendFile('./Logs/log_'+TimeStampFile()+'.txt', TimeStamp()+' '+text+'\n', function (err) {
                    				if (err) throw err;
                    			});
              } else {
              fs.writeFile('./Logs/log_'+TimeStampFile()+'.txt', TimeStamp()+' '+text+'\n', function(err) {
                  if(err) {
                      return console.log(err);
                  }
    
                //  console.log("The file was saved!");
              });
              }
            });
    
    		}
    
    	}
    }
    

    module.exports = {
    write : write,
    writeDateLog:writeDateLog,
    TimeStamp : TimeStamp
    };



  • @rds, nothing?? @Lexicon , @tross?



  • If I remember right I cut off logging cause it caused me problems. Maybe lexicon remembers the issue I had exactly. As funny as it is I forgot. But to put this in to perspective from Aug to Nov I seen and tested up to 20 different version of this pool code.



  • @rds you have to understand that not everyone is in the same country. the message you tagged me in 7 hours ago would of made it 3am here and burst isn't my full time job.

    personally if i was you i wouldn't enable logging cause the amount of writes to file causes issues. the pool will lag tremendously and even crash if the max files open exceeds the amount handled by the os



  • @Lexicon said in How do you enable logging in Lex pool?:

    @rds you have to understand that not everyone is in the same country. the message you tagged me in 7 hours ago would of made it 3am here and burst isn't my full time job.

    personally if i was you i wouldn't enable logging cause the amount of writes to file causes issues. the pool will lag tremendously and even crash if the max files open exceeds the amount handled by the os

    Sorry for the impatience. I bumped the thread because I didn't see a response for over 24 hours from the time the OP was written. I realize everyone has other things going on, and your help is greatly appreciated.


Log in to reply
 

Looks like your connection to Burst - Efficient HDD Mining was lost, please wait while we try to reconnect.