Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js add timestamp clg

var log = console.log;

console.log = function () {
    var first_parameter = arguments[0];
    var other_parameters = Array.prototype.slice.call(arguments, 1);

    function formatConsoleDate (date) {
        var hour = date.getHours();
        var minutes = date.getMinutes();
        var seconds = date.getSeconds();
        var milliseconds = date.getMilliseconds();

        return '[' +
               ((hour < 10) ? '0' + hour: hour) +
               ':' +
               ((minutes < 10) ? '0' + minutes: minutes) +
               ':' +
               ((seconds < 10) ? '0' + seconds: seconds) +
               '.' +
               ('00' + milliseconds).slice(-3) +
               '] ';
    }

    log.apply(console, [formatConsoleDate(new Date()) + first_parameter].concat(other_parameters));
};
Comment

PREVIOUS NEXT
Code Example
Javascript :: sequelize manual model/index.js 
Javascript :: trim string and place ... javascript 
Javascript :: how i do button when click open a new tab in react 
Javascript :: access to nested properties on javascript using property names 
Javascript :: moment.js format 
Javascript :: how to clear array in javascript 
Javascript :: make a function and return the index of specific character in javascript 
Javascript :: URLSearchParams for query params 
Javascript :: show and hide element in react 
Javascript :: javascript isempty 
Javascript :: what does event emitter do in angular 
Javascript :: drag drop in blazor 
Javascript :: redux action 
Javascript :: Convert mnemonic to seed in javascript 
Javascript :: create uuid to exist node neo4j 
Javascript :: jquery xpath 
Javascript :: javascript Create a RegEx 
Javascript :: javascript async await not waiting 
Javascript :: gettwofactorauthenticationuserasync returns null 
Javascript :: auto increase hight of textarea with alpine js 
Javascript :: javascript return value from async function 
Javascript :: merge two strings with alternate characters javascript 
Javascript :: how to use datepicker apply to send a get request 
Javascript :: redireccionar a una página con javascript después de un tiempo 
Javascript :: setTilme out js 
Javascript :: React ES6 Arrow Functions 
Javascript :: reverseString / Palindrome / Split string / Reverse Array 
Javascript :: react-native-charts-wrapper:compileDebugJavaWithJavac FAILED 
Javascript :: javascript push 
Javascript :: nextjks using window or document object 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =