Why not using native log?
Native log is good, but you almost always delete it after you finish your work. One reason can be logs are for developers so it's better to remove them after finishing the job. The other reason is that when team working comes in, everyone try to get the upper hand in logging. You might have seen funny delimiters like ---------- My Name -------- or red color messages all over your console. Finally the team end up with a huge mess that no body can easily find their logs in it. logeek will fix all these issues in a very simple manner. Now that you know why using the native log is a bad idea, read the rest of this document to find the solution.
You can install it using
npm depending on your project type.
npm install logeek --save
bower install logeek --save
make sure to include the
dist/logeek.js in your HTML or your Node application after you download it.
Logeek is easy to use, All you need to do is to include it and tell logeek which messages you want to be logged:
var logeek = ;logeek;;
This means that message 'M' will be shown when scope 'S' is visible. Suppose you are working on a copy module and you want to log some message:
var logeek = ;logeek; //setting the visible scope;;; //logs starting copy; //logs 50% done;; //logs 100% done;
This is what you'll see in your console:
starting copy 50% done 100% done
If you used
logeek.show('copy/*') your console would be like:
starting copy 50% done A file was skipped 100% done
Scopes are powerful ways to group your log message together and disable or enable them at a certain point. Not only you can create different groups, you can also nest these groups to create a relation between them and control them much easier.
logeek;;; //logs pulling...; //logs Oops!...//You can also set reverse filterslogeek;;;; //logs error in...;; //logs server is not...
Writing a long list of log messages can be a boring job. That's why logeek allows you to use an easier way of defining your message and scope at once. logeek uses '@' as the default delimiter for separating the message and the scope. The general format of compact message logging with logeek is:
logeek;;//these two are the same;;//these two are the same;;
Logeek plays well with other standard libraries such as Chalk. Here is an example of using Logeek with Chalk to control the console logs like a pro:
var chalk =logeek = ;logeek;
And this is what you see in your console: