Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeHitchens committed Sep 9, 2011
1 parent 5718c97 commit ac00694
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Original file line Diff line number Diff line change
@@ -1,9 +1,9 @@


# log5 - A simple logging utility. # log5 - A simple logging utility.


Provides a simple module with a log() function and a logLevel value. Provides a simple module with a log() function and a log level value.
The log() function writes the msg to stdout, prefixed with a timestamp, if The log() function writes the msg to stdout, prefixed with a timestamp, when
the logLevel is greater than or equal to the number in the first argument. the log level is greater than or equal to the number in the first argument.




## Install ## Install
Expand All @@ -12,31 +12,31 @@ the logLevel is greater than or equal to the number in the first argument.


## Examples ## Examples


log5 = require("log5") log = require("log5").mkLog()
log5.logLevel = 2 log(2)
log(2, "This prints") log(2, "This prints")
log(3, "This doesn't") log(3, "This doesn't")


You are free to make up whatever level numbers you want, and assign what ever meaning to them that You are free to make up whatever level numbers you want, and assign what ever meaning to them that
you want. you want.


It's very simple, and gets the job done, and allows you to change the log output at It's very simple, and gets the job done, and allows you to change the log output at
runtime if you like, by just changing the logLevel. runtime if you like, by just changing the log level.


## More examples ## More examples


log5 = require("log5") // log level defaults to 0 log = require("log5").mkLog() // log level defaults to 0
log = log5.log // for convenience log = log5.log // for convenience
log(1, "does not print") // because logLevel is 0 log(1, "does not print") // because log level is 0
log(1) // same as log5.logLevel = 1 log(1) // set log level to 1
log(1, "prints") log(1, "prints")
log(-1) // sure, why not? log(-1) // sure, why not?
log(0, "does not print") log(0, "does not print")
log("does not print") // if you don't include a # as first arg, 0 is used log("does not print") // if you don't include a # as first arg, 0 is used
log(0) log(0)
log("prints now") log("prints now")
log("foo", 7, ["bar","baz"]) // logs "foo 7 bar,baz" log("foo", 7, ["bar","baz"]) // logs "foo 7 bar,baz"
log(3, "foo", 7, ["bar","baz"]) // does not print - logLevel is 0 log(3, "foo", 7, ["bar","baz"]) // does not print - log level is 0


## License ## License


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Original file line Diff line number Diff line change
@@ -1,6 +1,6 @@
{ {
"name": "log5", "name": "log5",
"version": "1.2.1", "version": "1.2.3",
"description" : "A simple logging utility", "description" : "A simple logging utility",
"author": "Joe Hitchens <joe@sleepless.com> (sleepless.com)", "author": "Joe Hitchens <joe@sleepless.com> (sleepless.com)",
"license": { "license": {
Expand Down

0 comments on commit ac00694

Please sign in to comment.