0.0.7 • Published 7 years ago
divitolog v0.0.7
divitoLOG
AdHoc Logging Package
Prerequisites
For testing:
- Mocha
- Chai
Installing
Install with npm:
npm install divitolog
Running the tests
In Node.js
A single test can be run just using:
npm test
Expected results:
$ npm test
> divitolog@0.0.7 test /data/nodejs/node_projects/divitoLOG
> mocha test/test.js
recLog
recLog()
1480183881435 [paquete]{funcion} mensaje
✓ should display complete message
1480183881445 [paquete]{unknown package} mensaje
✓ should display module name, unknown package and complete message
1480183881447 [unknown module]{unknown package} mensaje
✓ should display unknown module, unknown package and complete message
3 passing (37ms)
$
In the Browser
To use divitoLOG in the browser, simply add the following script tag to your HTML pages:
<script src="./lib/divitoLOG.js"></script>
The basic syntax is as follows:
test.html
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js" type="text/javascript"></script>
<script src="divitoLOG.js" type="text/javascript"></script>
</head>
<body>
<div>
<b id="update"> this text will be updated in 3 seconds .. </b>
</div>
<script>
$(document).ready(function() {
console.log("ready!");
divitoLOG.recLog('test.html', 'loading <div>', 'START');
function updateText() {
$('#update').text('text updated !');
divitoLOG.recLog('test.html', 'loading <div>', 'END');
}
setTimeout(updateText, 3000);
});
</script>
</body>
</html>
License
This project is licensed under the MIT License - see the LICENSE.md file for details