From 2568e40a395b809fb34125b3383f9f2616004f73 Mon Sep 17 00:00:00 2001 From: isaacs Date: Wed, 6 Jun 2012 14:48:24 -0700 Subject: 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. --- lib/init.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'lib/init.js') 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) }) }) -- cgit v1.2.3