Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2012-06-07 01:48:24 +0400
committerisaacs <i@izs.me>2012-06-07 01:56:35 +0400
commit2568e40a395b809fb34125b3383f9f2616004f73 (patch)
treeb770c89d4ed5a46341bf3b42e563a7fbf110af32 /lib/init.js
parentd4b2d1149a0f2b56467ebeebd36e21d3a2bfe48a (diff)
Replace the log util with npmlog module
This feels so good. lib/utils/log.js is the worst kind of glue code that keeps the npm project from being properly abstracted into independent pieces. In the process, also cleaned up a lot of unproductive logging, and made the npm-debug.log generated on errors be a bit more easy to read.
Diffstat (limited to 'lib/init.js')
-rw-r--r--lib/init.js9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/init.js b/lib/init.js
index 7cd7da8e2..0d96e07ac 100644
--- a/lib/init.js
+++ b/lib/init.js
@@ -10,7 +10,7 @@ var read = require("read")
, promiseChain = require("./utils/promise-chain.js")
, exec = require("./utils/exec.js")
, semver = require("semver")
- , log = require("./utils/log.js")
+ , log = require("npmlog")
, npm = require("./npm.js")
, output = require("./utils/output.js")
@@ -18,8 +18,7 @@ init.usage = "npm init [folder]"
function init (args, cb) {
var folder = args[0] || "."
- , ll = npm.config.get("loglevel")
- npm.config.set("loglevel", "paused")
+ log.pause()
if (folder.charAt(0) !== "/") folder = path.join(process.cwd(), folder)
readJson(path.join(folder, "package.json"), function (er, data) {
@@ -31,8 +30,8 @@ function init (args, cb) {
, url: npm.config.get("init.author.url") }
init_(data, folder, function (er) {
- npm.config.set("loglevel", ll)
- if (!er) log(path.resolve(folder, "package.json"), "written")
+ log.resume()
+ if (!er) log.info("written", path.resolve(folder, "package.json"))
cb(er)
})
})