diff --git a/source/app.d b/source/app.d index c53ef59..f5b54ab 100644 --- a/source/app.d +++ b/source/app.d @@ -44,7 +44,7 @@ // parse general options bool verbose, vverbose, quiet, vquiet; bool help, nodeps, annotate; - LogLevel loglevel = LogLevel.Info; + LogLevel loglevel = LogLevel.info; string build_type = "debug", build_config; string compiler_name = "dmd"; string arch; @@ -73,10 +73,10 @@ "version", &install_version ); - if( vverbose ) loglevel = LogLevel.Trace; - else if( verbose ) loglevel = LogLevel.Debug; - else if( vquiet ) loglevel = LogLevel.None; - else if( quiet ) loglevel = LogLevel.Warn; + if( vverbose ) loglevel = LogLevel.debug_; + else if( verbose ) loglevel = LogLevel.diagnostic; + else if( vquiet ) loglevel = LogLevel.none; + else if( quiet ) loglevel = LogLevel.warn; setLogLevel(loglevel); // extract the command @@ -146,7 +146,7 @@ case "upgrade": dub.loadPackageFromCwd(); logInfo("Upgrading project in %s", dub.projectPath.toNativeString()); - logDebug("dub initialized"); + logDiagnostic("dub initialized"); dub.update(UpdateOptions.Upgrade | (annotate ? UpdateOptions.JustAnnotate : UpdateOptions.None)); return 0; case "install": @@ -234,7 +234,7 @@ if( !nodeps ){ logInfo("Checking dependencies in '%s'", dub.projectPath.toNativeString()); - logDebug("dub initialized"); + logDiagnostic("dub initialized"); dub.update(annotate ? UpdateOptions.JustAnnotate : UpdateOptions.None); } @@ -250,7 +250,7 @@ gensettings.run = cmd == "run"; gensettings.runArgs = args[1 .. $]; - logDebug("Generating using %s", generator); + logDiagnostic("Generating using %s", generator); dub.generateProject(generator, gensettings); if( build_type == "ddox" ) dub.runDdox(); break; @@ -265,7 +265,7 @@ catch(Throwable e) { logError("Error: %s\n", e.msg); - logDebug("Full exception: %s", sanitize(e.toString())); + logDiagnostic("Full exception: %s", sanitize(e.toString())); logInfo("Run 'dub help' for usage information."); return 1; } diff --git a/source/dub/compilers/compiler.d b/source/dub/compilers/compiler.d index 9e39610..36456e3 100644 --- a/source/dub/compilers/compiler.d +++ b/source/dub/compilers/compiler.d @@ -116,7 +116,7 @@ if (settings.libs.length == 0) return; try { - logDebug("Trying to use pkg-config to resolve library flags for %s.", settings.libs); + logDiagnostic("Trying to use pkg-config to resolve library flags for %s.", settings.libs); auto libflags = execute(["pkg-config", "--libs"] ~ settings.libs.map!(l => "lib"~l)().array()); enforce(libflags.status == 0, "pkg-config exited with error code "~to!string(libflags.status)); foreach (f; libflags.output.split()) { @@ -124,8 +124,8 @@ else settings.addLFlags(f); } } catch( Exception e ){ - logDebug("pkg-config failed: %s", e.msg); - logDebug("Falling back to direct -lxyz flags."); + logDiagnostic("pkg-config failed: %s", e.msg); + logDiagnostic("Falling back to direct -lxyz flags."); version(Windows) settings.addSourceFiles(settings.libs.map!(l => l~".lib")().array()); else settings.addLFlags(settings.libs.map!(l => "-l"~l)().array()); } diff --git a/source/dub/compilers/dmd.d b/source/dub/compilers/dmd.d index d7975a9..0fbc3c5 100644 --- a/source/dub/compilers/dmd.d +++ b/source/dub/compilers/dmd.d @@ -114,7 +114,7 @@ auto args = [platform.compiler, "-of"~tpath.toNativeString()] ~ objects ~ settings.lflags.map!(l => "-L"~l)().array() ~ settings.sourceFiles; static linkerargs = ["-g", "-gc", "-m32", "-m64"]; args ~= settings.dflags.filter!(f => linkerargs.canFind(f))().array(); - logDebug("%s", args.join(" ")); + logDiagnostic("%s", args.join(" ")); auto res = spawnProcess(args).wait(); enforce(res == 0, "Link command failed with exit code "~to!string(res)); } diff --git a/source/dub/dependency.d b/source/dub/dependency.d index 1ed6bdf..2f2602f 100644 --- a/source/dub/dependency.d +++ b/source/dub/dependency.d @@ -354,7 +354,7 @@ bool matches(string vers) const { return matches(Version(vers)); } bool matches(const(Version) v) const { return matches(v); } bool matches(ref const(Version) v) const { - //logTrace(" try match: %s with: %s", v, this); + //logDebug(" try match: %s with: %s", v, this); // Master only matches master if(m_versA == Version.MASTER || m_versA.isBranch) { enforce(m_versA == m_versB); @@ -409,7 +409,7 @@ } private static bool doCmp(string mthd, ref const Version a, ref const Version b) { - //logTrace("Calling %s%s%s", a, mthd, b); + //logDebug("Calling %s%s%s", a, mthd, b); switch(mthd) { default: throw new Exception("Unknown comparison operator: "~mthd); case ">": return a>b; @@ -508,7 +508,7 @@ b.optional = true; assert(a.merge(b).optional, "Merging two optional dependencies wrong."); - logTrace("Dependency Unittest sucess."); + logDebug("Dependency Unittest sucess."); } struct RequestedDependency { @@ -550,7 +550,7 @@ unused.remove(avail.name); }); foreach(string unusedPkg, d; unused) { - logTrace("Removed unused package: "~unusedPkg); + logDebug("Removed unused package: "~unusedPkg); m_packages.remove(unusedPkg); } } @@ -603,7 +603,7 @@ } private static void addDependency(ref RequestedDependency[string] deps, string packageId, const Dependency d, const Package issuer) { - logTrace("addDependency "~packageId~", '%s'", d); + logDebug("addDependency "~packageId~", '%s'", d); auto d2 = packageId in deps; if(!d2) { deps[packageId] = RequestedDependency(issuer.name, d); diff --git a/source/dub/dub.d b/source/dub/dub.d index ae6f68e..248a805 100644 --- a/source/dub/dub.d +++ b/source/dub/dub.d @@ -42,7 +42,7 @@ PackageSupplier[] defaultPackageSuppliers() { Url url = Url.parse("http://registry.vibed.org/"); - logDebug("Using dub registry url '%s'", url); + logDiagnostic("Using dub registry url '%s'", url); return [new RegistryPS(url)]; } @@ -218,7 +218,7 @@ logInfo("Downloading %s %s...", packageId, ver); - logDebug("Acquiring package zip file"); + logDiagnostic("Acquiring package zip file"); auto dload = m_projectPath ~ ".dub/temp/downloads"; auto tempfname = packageId ~ "-" ~ (ver.startsWith('~') ? ver[1 .. $] : ver) ~ ".zip"; auto tempFile = m_tempPath ~ tempfname; @@ -288,7 +288,7 @@ throw new Exception("Failed to uninstall package."); } - logTrace("Uninstalling %s packages.", packages.length); + logDebug("Uninstalling %s packages.", packages.length); foreach(pack; packages) { try { uninstall(pack); diff --git a/source/dub/generators/build.d b/source/dub/generators/build.d index 792eea4..1789a71 100644 --- a/source/dub/generators/build.d +++ b/source/dub/generators/build.d @@ -90,7 +90,7 @@ } exe_file_path = Path(buildsettings.targetPath) ~ getTargetFileName(buildsettings, settings.platform); } - logDebug("Application output name is '%s'", exe_file_path.toNativeString()); + logDiagnostic("Application output name is '%s'", exe_file_path.toNativeString()); finalizeGeneration(buildsettings, generate_binary); @@ -126,7 +126,7 @@ // invoke the compiler logInfo("Running %s...", settings.compilerBinary); - logDebug("%s %s", settings.compilerBinary, join(buildsettings.dflags, " ")); + logDiagnostic("%s %s", settings.compilerBinary, join(buildsettings.dflags, " ")); if( settings.run ) cleanup_files ~= exe_file_path; auto compiler_pid = spawnProcess([settings.compilerBinary, "@"~res_file.toNativeString()]); auto result = compiler_pid.wait(); @@ -156,7 +156,7 @@ std.file.write(res_file.toNativeString(), join(buildsettings.dflags, "\n")); logInfo("Running %s (compile)...", settings.compilerBinary); - logDebug("%s %s", settings.compilerBinary, join(buildsettings.dflags, " ")); + logDiagnostic("%s %s", settings.compilerBinary, join(buildsettings.dflags, " ")); auto result = spawnProcess([settings.compilerBinary, "@"~res_file.toNativeString()]).wait(); enforce(result == 0, "Build command failed with exit code "~to!string(result)); diff --git a/source/dub/generators/generator.d b/source/dub/generators/generator.d index 11d4a58..402a01e 100644 --- a/source/dub/generators/generator.d +++ b/source/dub/generators/generator.d @@ -59,16 +59,16 @@ default: throw new Exception("Unknown project generator: "~generator_type); case "build": - logTrace("Creating build generator."); + logDebug("Creating build generator."); return new BuildGenerator(app, mgr); case "rdmd": - logTrace("Creating rdmd generator."); + logDebug("Creating rdmd generator."); return new RdmdGenerator(app, mgr); case "mono-d": - logTrace("Creating MonoD generator."); + logDebug("Creating MonoD generator."); return new MonoDGenerator(app, mgr); case "visuald": - logTrace("Creating VisualD generator."); + logDebug("Creating VisualD generator."); return new VisualDGenerator(app, mgr); } } @@ -120,7 +120,7 @@ foreach (f; buildsettings.copyFiles) { auto src = Path(f); auto dst = Path(buildsettings.targetPath) ~ Path(f).head; - logDebug(" %s to %s", src.toNativeString(), dst.toNativeString()); + logDiagnostic(" %s to %s", src.toNativeString(), dst.toNativeString()); try { copyFile(src, dst, true); } catch logWarn("Failed to copy to %s", dst.toNativeString()); diff --git a/source/dub/generators/monod.d b/source/dub/generators/monod.d index 1c054fb..1fa89a0 100644 --- a/source/dub/generators/monod.d +++ b/source/dub/generators/monod.d @@ -51,7 +51,7 @@ prepareGeneration(buildsettings); - logTrace("About to generate projects for %s, with %s direct dependencies.", m_app.mainPackage().name, m_app.mainPackage().dependencies().length); + logDebug("About to generate projects for %s, with %s direct dependencies.", m_app.mainPackage().name, m_app.mainPackage().dependencies().length); generateProjects(m_app.mainPackage(), settings); generateSolution(settings); @@ -64,7 +64,7 @@ scope(exit) sln.close(); // Writing solution file - logTrace("About to write to .sln file."); + logDebug("About to write to .sln file."); // Solution header sln.put('\n'); @@ -153,7 +153,7 @@ private void generateProject(in Package pack, GeneratorSettings settings) { - logTrace("About to write to '%s.dproj' file", pack.name); + logDebug("About to write to '%s.dproj' file", pack.name); auto sln = openFile(pack.name ~ ".dproj", FileMode.CreateTrunc); scope(exit) sln.close(); @@ -271,7 +271,7 @@ bool[const(Package)] visited; void perform_rec(const Package parent_pack){ foreach(id, dependency; parent_pack.dependencies){ - logDebug("Retrieving package %s from package manager.", id); + logDiagnostic("Retrieving package %s from package manager.", id); auto pack = m_pkgMgr.getBestPackage(id, dependency); if( pack in visited ) continue; visited[pack] = true; @@ -279,7 +279,7 @@ logWarn("Package %s (%s) could not be retrieved continuing...", id, to!string(dependency)); continue; } - logDebug("Performing on retrieved package %s", pack.name); + logDiagnostic("Performing on retrieved package %s", pack.name); op(pack); perform_rec(pack); } diff --git a/source/dub/generators/rdmd.d b/source/dub/generators/rdmd.d index ebfd85d..be29713 100644 --- a/source/dub/generators/rdmd.d +++ b/source/dub/generators/rdmd.d @@ -82,7 +82,7 @@ settings.compiler.setTarget(buildsettings, settings.platform); } - logDebug("Application output name is '%s'", getTargetFileName(buildsettings, settings.platform)); + logDiagnostic("Application output name is '%s'", getTargetFileName(buildsettings, settings.platform)); string[] flags = ["--build-only", "--compiler="~settings.compilerBinary]; flags ~= buildsettings.dflags; @@ -100,7 +100,7 @@ else logInfo("Building default configuration, build type "~settings.buildType); logInfo("Running rdmd..."); - logDebug("rdmd %s", join(flags, " ")); + logDiagnostic("rdmd %s", join(flags, " ")); auto rdmd_pid = spawnProcess("rdmd" ~ flags); auto result = rdmd_pid.wait(); enforce(result == 0, "Build command failed with exit code "~to!string(result)); diff --git a/source/dub/generators/visuald.d b/source/dub/generators/visuald.d index 5cffe3f..8cf0d8b 100644 --- a/source/dub/generators/visuald.d +++ b/source/dub/generators/visuald.d @@ -52,7 +52,7 @@ prepareGeneration(buildsettings); - logTrace("About to generate projects for %s, with %s direct dependencies.", m_app.mainPackage().name, m_app.mainPackage().dependencies().length); + logDebug("About to generate projects for %s, with %s direct dependencies.", m_app.mainPackage().name, m_app.mainPackage().dependencies().length); generateProjects(m_app.mainPackage(), settings); generateSolution(settings); logInfo("VisualD project generated."); @@ -105,7 +105,7 @@ EndGlobal"); // Writing solution file - logTrace("About to write to .sln file with %s bytes", to!string(ret.data().length)); + logDebug("About to write to .sln file with %s bytes", to!string(ret.data().length)); auto sln = openFile(solutionFileName(), FileMode.CreateTrunc); scope(exit) sln.close(); sln.put(ret.data()); @@ -239,7 +239,7 @@ ret.formattedWrite("\n ", getPackageFileName(pack)); Path lastFolder; foreach(source; sortedSources(sourceFiles.keys)) { - logTrace("source looking at %s", source.structurePath); + logDebug("source looking at %s", source.structurePath); auto cur = source.structurePath[0 .. source.structurePath.length-1]; if(lastFolder != cur) { size_t same = 0; @@ -263,7 +263,7 @@ ret.put("\n "); ret.put("\n \n"); - logTrace("About to write to '%s.visualdproj' file %s bytes", getPackageFileName(pack), ret.data().length); + logDebug("About to write to '%s.visualdproj' file %s bytes", getPackageFileName(pack), ret.data().length); auto proj = openFile(projFileName(pack), FileMode.CreateTrunc); scope(exit) proj.close(); proj.put(ret.data()); @@ -442,7 +442,7 @@ bool[const(Package)] visited; void perform_rec(const Package parent_pack){ foreach(id, dependency; parent_pack.dependencies){ - logTrace("Retrieving package %s from package manager.", id); + logDebug("Retrieving package %s from package manager.", id); auto pack = m_pkgMgr.getBestPackage(id, dependency); if( pack in visited ) continue; if( pack is null && dependency.optional ) { @@ -451,7 +451,7 @@ // want to spawn an error (an finally mark it as // visited). // TODO: should this information be posted to the user? - logDebug("An optional dependency was not found: %s, %s", id, dependency); + logDiagnostic("An optional dependency was not found: %s, %s", id, dependency); continue; } visited[pack] = true; @@ -459,7 +459,7 @@ logWarn("Package %s (%s) could not be retrieved continuing...", id, to!string(dependency)); continue; } - logTrace("Performing on retrieved package %s", pack.name); + logDebug("Performing on retrieved package %s", pack.name); op(pack); perform_rec(pack); } diff --git a/source/dub/internal/vibecompat/core/file.d b/source/dub/internal/vibecompat/core/file.d index a8b599a..e8fb6bd 100644 --- a/source/dub/internal/vibecompat/core/file.d +++ b/source/dub/internal/vibecompat/core/file.d @@ -83,7 +83,7 @@ auto tmpname = to!string(tmp.ptr); if( tmpname.startsWith("\\") ) tmpname = tmpname[1 .. $]; tmpname ~= suffix; - logDebug("tmp %s", tmpname); + logDiagnostic("tmp %s", tmpname); return openFile(tmpname, FileMode.CreateTrunc); } else { import core.sys.posix.stdio; diff --git a/source/dub/internal/vibecompat/core/log.d b/source/dub/internal/vibecompat/core/log.d index 6701564..cbfd1bc 100644 --- a/source/dub/internal/vibecompat/core/log.d +++ b/source/dub/internal/vibecompat/core/log.d @@ -14,7 +14,7 @@ import core.thread; private { - shared LogLevel s_minLevel = LogLevel.Info; + shared LogLevel s_minLevel = LogLevel.info; shared LogLevel s_logFileLevel; } @@ -31,15 +31,15 @@ level = The log level for the logged message fmt = See http://dlang.org/phobos/std_format.html#format-string */ -void logTrace(T...)(string fmt, auto ref T args) nothrow { log(LogLevel.Trace, fmt, args); } +void logDebug(T...)(string fmt, auto ref T args) nothrow { log(LogLevel.debug_, fmt, args); } /// ditto -void logDebug(T...)(string fmt, auto ref T args) nothrow { log(LogLevel.Debug, fmt, args); } +void logDiagnostic(T...)(string fmt, auto ref T args) nothrow { log(LogLevel.diagnostic, fmt, args); } /// ditto -void logInfo(T...)(string fmt, auto ref T args) nothrow { log(LogLevel.Info, fmt, args); } +void logInfo(T...)(string fmt, auto ref T args) nothrow { log(LogLevel.info, fmt, args); } /// ditto -void logWarn(T...)(string fmt, auto ref T args) nothrow { log(LogLevel.Warn, fmt, args); } +void logWarn(T...)(string fmt, auto ref T args) nothrow { log(LogLevel.warn, fmt, args); } /// ditto -void logError(T...)(string fmt, auto ref T args) nothrow { log(LogLevel.Error, fmt, args); } +void logError(T...)(string fmt, auto ref T args) nothrow { log(LogLevel.error, fmt, args); } /// ditto void log(T...)(LogLevel level, string fmt, auto ref T args) @@ -47,13 +47,13 @@ if( level < s_minLevel ) return; string pref; final switch( level ){ - case LogLevel.Trace: pref = "trc"; break; - case LogLevel.Debug: pref = "dbg"; break; - case LogLevel.Info: pref = "INF"; break; - case LogLevel.Warn: pref = "WRN"; break; - case LogLevel.Error: pref = "ERR"; break; - case LogLevel.Fatal: pref = "FATAL"; break; - case LogLevel.None: assert(false); + case LogLevel.debug_: pref = "trc"; break; + case LogLevel.diagnostic: pref = "dbg"; break; + case LogLevel.info: pref = "INF"; break; + case LogLevel.warn: pref = "WRN"; break; + case LogLevel.error: pref = "ERR"; break; + case LogLevel.fatal: pref = "FATAL"; break; + case LogLevel.none: assert(false); } try { @@ -67,7 +67,7 @@ fiberid ^= fiberid >> 32; if( level >= s_minLevel ){ - if (level == LogLevel.Info) { + if (level == LogLevel.info) { stdout.writeln(txt.data()); stdout.flush(); } else { @@ -83,12 +83,12 @@ /// Specifies the log level for a particular log message. enum LogLevel { - Trace, - Debug, - Info, - Warn, - Error, - Fatal, - None + debug_, + diagnostic, + info, + warn, + error, + fatal, + none } diff --git a/source/dub/package_.d b/source/dub/package_.d index 45a137c..85f2903 100644 --- a/source/dub/package_.d +++ b/source/dub/package_.d @@ -102,13 +102,13 @@ m_info.version_ = "~" ~ branch.output.strip(); } } catch (Exception e) { - logDebug("Failed to run git: %s", e.msg); + logDiagnostic("Failed to run git: %s", e.msg); } if (m_info.version_.length == 0) { - logDebug("Failed to determine version of package %s at %s. Assuming ~master.", m_info.name, this.path.toNativeString()); + logDiagnostic("Failed to determine version of package %s at %s. Assuming ~master.", m_info.name, this.path.toNativeString()); m_info.version_ = "~master"; - } else logDebug("Determined package version using GIT: %s %s", m_info.name, m_info.version_); + } else logDiagnostic("Determined package version using GIT: %s %s", m_info.name, m_info.version_); } } @@ -187,7 +187,7 @@ /// Returns all BuildSettings for the given platform and config. BuildSettings getBuildSettings(in BuildPlatform platform, string config) const { - logDebug("Using config %s for %s", config, this.name); + logDiagnostic("Using config %s for %s", config, this.name); foreach(ref conf; m_info.configurations){ if( conf.name != config ) continue; BuildSettings ret; diff --git a/source/dub/packagemanager.d b/source/dub/packagemanager.d index 00aa867..e2473a3 100644 --- a/source/dub/packagemanager.d +++ b/source/dub/packagemanager.d @@ -172,7 +172,7 @@ auto package_version = package_info["version"].get!string(); auto clean_package_version = package_version[package_version.startsWith("~") ? 1 : 0 .. $]; - logDebug("Installing package '%s' version '%s' to location '%s' from file '%s'", + logDiagnostic("Installing package '%s' version '%s' to location '%s' from file '%s'", package_name, package_version, destination.toNativeString(), zip_file_path.toNativeString()); if( existsFile(destination) ){ @@ -182,13 +182,13 @@ // open zip file ZipArchive archive; { - logTrace("Opening file %s", zip_file_path); + logDebug("Opening file %s", zip_file_path); auto f = openFile(zip_file_path, FileMode.Read); scope(exit) f.close(); archive = new ZipArchive(f.readAll()); } - logTrace("Installing from zip."); + logDebug("Installing from zip."); // In a github zip, the actual contents are in a subfolder Path zip_prefix; @@ -207,7 +207,7 @@ zip_prefix = Path(am.name); } - logTrace("zip root folder: %s", zip_prefix); + logDebug("zip root folder: %s", zip_prefix); Path getCleanedPath(string fileName) { auto path = Path(fileName); @@ -218,14 +218,14 @@ // install mkdirRecurse(destination.toNativeString()); auto journal = new Journal; - logDebug("Copying all files..."); + logDiagnostic("Copying all files..."); int countFiles = 0; foreach(ArchiveMember a; archive.directory) { auto cleanedPath = getCleanedPath(a.name); if(cleanedPath.empty) continue; auto dst_path = destination~cleanedPath; - logTrace("Creating %s", cleanedPath); + logDebug("Creating %s", cleanedPath); if( dst_path.endsWithSlash ){ if( !existsDirectory(dst_path) ) mkdirRecurse(dst_path.toNativeString()); @@ -240,7 +240,7 @@ ++countFiles; } } - logDebug("%s file(s) copied.", to!string(countFiles)); + logDiagnostic("%s file(s) copied.", to!string(countFiles)); // overwrite package.json (this one includes a version field) Json pi = jsonFromFile(destination~PackageJsonFilename); @@ -249,7 +249,7 @@ writeJsonFile(destination~PackageJsonFilename, pi); // Write journal - logTrace("Saving installation journal..."); + logDebug("Saving installation journal..."); journal.add(Journal.Entry(Journal.Type.RegularFile, Path(JournalJsonFilename))); journal.save(destination ~ JournalJsonFilename); @@ -265,7 +265,7 @@ void uninstall(in Package pack) { - logTrace("Uninstall %s, version %s, path '%s'", pack.name, pack.vers, pack.path); + logDebug("Uninstall %s, version %s, path '%s'", pack.name, pack.vers, pack.path); enforce(!pack.path.empty, "Cannot uninstall package "~pack.name~" without a path."); // remove package from repositories' list @@ -295,16 +295,16 @@ enforce(found, "Cannot uninstall, package not found: '"~ pack.name ~"', path: " ~ to!string(pack.path)); // delete package files physically - logTrace("Looking up journal"); + logDebug("Looking up journal"); auto journalFile = pack.path~JournalJsonFilename; if( !existsFile(journalFile) ) throw new Exception("Uninstall failed, no installation journal found for '"~pack.name~"'. Please uninstall manually."); auto packagePath = pack.path; auto journal = new Journal(journalFile); - logTrace("Erasing files"); + logDebug("Erasing files"); foreach( Journal.Entry e; filter!((Journal.Entry a) => a.type == Journal.Type.RegularFile)(journal.entries)) { - logTrace("Deleting file '%s'", e.relFilename); + logDebug("Deleting file '%s'", e.relFilename); auto absFile = pack.path~e.relFilename; if(!existsFile(absFile)) { logWarn("Previously installed file not found for uninstalling: '%s'", absFile); @@ -314,13 +314,13 @@ removeFile(absFile); } - logDebug("Erasing directories"); + logDiagnostic("Erasing directories"); Path[] allPaths; foreach(Journal.Entry e; filter!((Journal.Entry a) => a.type == Journal.Type.Directory)(journal.entries)) allPaths ~= pack.path~e.relFilename; sort!("a.length>b.length")(allPaths); // sort to erase deepest paths first foreach(Path p; allPaths) { - logTrace("Deleting folder '%s'", p); + logDebug("Deleting folder '%s'", p); if( !existsFile(p) || !isDir(p.toNativeString()) || !isEmptyDir(p) ) { logError("Alien files found, directory is not empty or is not a directory: '%s'", p); continue; @@ -332,11 +332,11 @@ auto dubDir = (pack.path ~ ".dub/").toNativeString(); enforce(!existsFile(dubDir) || isDir(dubDir), ".dub should be a directory, but is a file."); if(existsFile(dubDir) && isDir(dubDir)) { - logTrace(".dub directory found, removing directory including content."); + logDebug(".dub directory found, removing directory including content."); rmdirRecurse(dubDir); } - logTrace("About to delete root folder for package '%s'.", pack.path); + logDebug("About to delete root folder for package '%s'.", pack.path); if(!isEmptyDir(pack.path)) throw new Exception("Alien files found in '"~pack.path.toNativeString()~"', needs to be deleted manually."); @@ -417,9 +417,9 @@ Package[] packs; Path[] paths; try { - logDebug("Looking for local package map at %s", list_path.toNativeString()); + logDiagnostic("Looking for local package map at %s", list_path.toNativeString()); if( !existsFile(list_path ~ LocalPackagesFilename) ) return; - logDebug("Try to load local package map at %s", list_path.toNativeString()); + logDiagnostic("Try to load local package map at %s", list_path.toNativeString()); auto packlist = jsonFromFile(list_path ~ LocalPackagesFilename); enforce(packlist.type == Json.Type.Array, LocalPackagesFilename~" must contain an array."); foreach( pentry; packlist ){ @@ -452,7 +452,7 @@ } } } catch( Exception e ){ - logDebug("Loading of local package list at %s failed: %s", list_path.toNativeString(), e.msg); + logDiagnostic("Loading of local package list at %s failed: %s", list_path.toNativeString(), e.msg); } m_repositories[type].localPackages = packs; m_repositories[type].searchPath = paths; @@ -466,9 +466,9 @@ void scanPackageFolder(Path path) { if( path.existsDirectory() ){ - logTrace("iterating dir %s", path.toNativeString()); + logDebug("iterating dir %s", path.toNativeString()); try foreach( pdir; iterateDirectory(path) ){ - logTrace("iterating dir %s entry %s", path.toNativeString(), pdir.name); + logDebug("iterating dir %s entry %s", path.toNativeString(), pdir.name); if( !pdir.isDirectory ) continue; auto pack_path = path ~ pdir.name; if( !existsFile(pack_path ~ PackageJsonFilename) ) continue; @@ -485,10 +485,10 @@ m_packages[p.name] ~= p; } catch( Exception e ){ logError("Failed to load package in %s: %s", pack_path, e.msg); - logDebug("Full error: %s", e.toString().sanitize()); + logDiagnostic("Full error: %s", e.toString().sanitize()); } } - catch(Exception e) logDebug("Failed to enumerate %s packages: %s", path.toNativeString(), e.toString()); + catch(Exception e) logDiagnostic("Failed to enumerate %s packages: %s", path.toNativeString(), e.toString()); } } @@ -515,15 +515,15 @@ sha1.put(cast(ubyte[])Path(file.name).head.toString()); if(file.isDir) { - logTrace("Hashed directory name %s", Path(file.name).head); + logDebug("Hashed directory name %s", Path(file.name).head); } else { sha1.put(openFile(Path(file.name)).readAll()); - logTrace("Hashed file contents from %s", Path(file.name).head); + logDebug("Hashed file contents from %s", Path(file.name).head); } } auto hash = sha1.finish(); - logTrace("Project hash: %s", hash); + logDebug("Project hash: %s", hash); return hash[0..$]; } diff --git a/source/dub/packagesupplier.d b/source/dub/packagesupplier.d index bc60d12..f6f08e2 100644 --- a/source/dub/packagesupplier.d +++ b/source/dub/packagesupplier.d @@ -50,10 +50,10 @@ Version bestVersion = Version(Version.RELEASE); foreach(DirEntry d; dirEntries(m_path.toNativeString(), packageId~"*", SpanMode.shallow)) { Path p = Path(d.name); - logTrace("Entry: %s", p); + logDebug("Entry: %s", p); enforce(to!string(p.head)[$-4..$] == ".zip"); string vers = to!string(p.head)[packageId.length+1..$-4]; - logTrace("Version string: "~vers); + logDebug("Version string: "~vers); Version v = Version(vers); if(v > bestVersion && dep.matches(v) ) { bestVersion = v; @@ -65,7 +65,7 @@ if(bestVersion == Version.RELEASE || !existsFile(fileName)) throw new Exception("No matching package found"); - logDebug("Found best matching package: '%s'", fileName); + logDiagnostic("Found best matching package: '%s'", fileName); return fileName; } } \ No newline at end of file diff --git a/source/dub/project.d b/source/dub/project.d index ebfa907..e3d9e9b 100644 --- a/source/dub/project.d +++ b/source/dub/project.d @@ -149,7 +149,7 @@ void reinit() { scope(failure){ - logDebug("Failed to initialize project. Assuming defaults."); + logDiagnostic("Failed to initialize project. Assuming defaults."); m_main = new Package(serializeToJson(["name": "unknown"]), m_root); } @@ -158,7 +158,7 @@ m_packageManager.refresh(false); try m_json = jsonFromFile(m_root ~ ".dub/dub.json", true); - catch(Exception t) logDebug("Failed to read .dub/dub.json: %s", t.msg); + catch(Exception t) logDiagnostic("Failed to read .dub/dub.json: %s", t.msg); if( !existsFile(m_root~PackageJsonFilename) ){ logWarn("There was no '"~PackageJsonFilename~"' found for the application in '%s'.", m_root.toNativeString()); @@ -180,19 +180,19 @@ // conflicts would then also be detected. void collectDependenciesRec(Package pack) { - logDebug("Collecting dependencies for %s", pack.name); + logDiagnostic("Collecting dependencies for %s", pack.name); foreach( name, vspec; pack.dependencies ){ Package p; if( !vspec.path.empty ){ Path path = vspec.path; if( !path.absolute ) path = pack.path ~ path; - logDebug("Adding local %s %s", path, vspec.version_); + logDiagnostic("Adding local %s %s", path, vspec.version_); p = m_packageManager.addTemporaryPackage(path, vspec.version_); } else { p = m_packageManager.getBestPackage(name, vspec); } if( !m_dependencies.canFind(p) ){ - logDebug("Found dependency %s %s: %s", name, vspec.toString(), p !is null); + logDiagnostic("Found dependency %s %s: %s", name, vspec.toString(), p !is null); if( p ){ m_dependencies ~= p; p.warnOnSpecialCompilerFlags(); @@ -316,11 +316,11 @@ auto p = basepkg in installed; // TODO: auto update to latest head revision if(!p || (!d.dependency.matches(p.vers) && !d.dependency.matches(Version.MASTER))) { - if(!p) logDebug("Triggering installation of required package '"~basepkg~"', which is not installed."); - else logDebug("Triggering installation of required package '"~basepkg~"', which doesn't match the required versionh. Required '%s', available '%s'.", d.dependency, p.vers); + if(!p) logDiagnostic("Triggering installation of required package '"~basepkg~"', which is not installed."); + else logDiagnostic("Triggering installation of required package '"~basepkg~"', which doesn't match the required versionh. Required '%s', available '%s'.", d.dependency, p.vers); actions ~= Action.install(basepkg, InstallLocation.userWide, d.dependency, d.packages); } else { - logDebug("Required package '"~basepkg~"' found with version '"~p.vers~"'"); + logDiagnostic("Required package '"~basepkg~"' found with version '"~p.vers~"'"); if( option & UpdateOptions.Upgrade ) actions ~= Action.install(basepkg, InstallLocation.userWide, d.dependency, d.packages); } @@ -339,19 +339,19 @@ scope(exit) iFile.close(); while(!iFile.empty) ignores ~= to!string(cast(char[])iFile.readLine()); - logDebug("Using '%s' found by the application.", ignoreFile); + logDiagnostic("Using '%s' found by the application.", ignoreFile); } else { ignores ~= ".svn/*"; ignores ~= ".git/*"; ignores ~= ".hg/*"; - logDebug("The '%s' file was not found, defaulting to ignore:", ignoreFile); + logDiagnostic("The '%s' file was not found, defaulting to ignore:", ignoreFile); } ignores ~= ".dub/*"; // .dub will not be included foreach(string i; ignores) - logDebug(" " ~ i); + logDiagnostic(" " ~ i); - logDebug("Creating zip file from application: " ~ m_main.name); + logDiagnostic("Creating zip file from application: " ~ m_main.name); auto archive = new ZipArchive(); foreach( string file; dirEntries(to!string(m_root), SpanMode.depth) ) { enforce( Path(file).startsWith(m_root) ); @@ -362,7 +362,7 @@ if(globMatch(file, ignore)) would work, as I see it; continue; - logDebug(" Adding member: %s", p); + logDiagnostic(" Adding member: %s", p); ArchiveMember am = new ArchiveMember(); am.name = to!string(p); auto f = openFile(file); @@ -371,7 +371,7 @@ archive.addMember(am); } - logDebug(" Writing zip: %s", destination); + logDiagnostic(" Writing zip: %s", destination); auto dst = openFile(destination, FileMode.CreateTrunc); scope(exit) dst.close(); dst.write(cast(ubyte[])archive.build()); @@ -418,7 +418,7 @@ RequestedDependency[string] missing = graph.missing(); RequestedDependency[string] oldMissing; while( missing.length > 0 ) { - logTrace("Try to resolve %s", missing.keys); + logDebug("Try to resolve %s", missing.keys); if( missing.keys == oldMissing.keys ){ // FIXME: should actually compare the complete AA here bool different = false; foreach(string pkg, reqDep; missing) { @@ -435,7 +435,7 @@ } oldMissing = missing.dup; - logTrace("There are %s packages missing.", missing.length); + logDebug("There are %s packages missing.", missing.length); auto toLookup = missing; foreach(id, dep; graph.optional()) { @@ -445,16 +445,16 @@ foreach(string pkg, reqDep; toLookup) { if(!reqDep.dependency.valid()) { - logTrace("Dependency to "~pkg~" is invalid. Trying to fix by modifying others."); + logDebug("Dependency to "~pkg~" is invalid. Trying to fix by modifying others."); continue; } auto ppath = pkg.split(":"); // TODO: auto update and update interval by time - logTrace("Adding package to graph: "~pkg); + logDebug("Adding package to graph: "~pkg); Package p = m_packageManager.getBestPackage(pkg, reqDep.dependency); - if( p ) logTrace("Found installed package %s %s", pkg, p.ver); + if( p ) logDebug("Found installed package %s %s", pkg, p.ver); // Don't bother with not available optional packages. if( !p && reqDep.dependency.optional ) continue; @@ -467,7 +467,7 @@ if( !p ){ try { - logDebug("using package from registry"); + logDiagnostic("using package from registry"); foreach(ps; packageSuppliers){ try { p = new Package(ps.getPackageDescription(ppath[0], reqDep.dependency)); @@ -475,7 +475,7 @@ p = p.getSubPackage(spn); break; } catch(Exception e) { - logDebug("No metadata for %s: %s", ps.classinfo.name, e.msg); + logDiagnostic("No metadata for %s: %s", ps.classinfo.name, e.msg); } } enforce(p !is null, "Could not find package candidate for "~pkg~" "~reqDep.dependency.toString()); @@ -515,7 +515,7 @@ } private void markUpToDate(string packageId) { - logTrace("markUpToDate(%s)", packageId); + logDebug("markUpToDate(%s)", packageId); Json create(ref Json json, string object) { if( object !in json ) json[object] = Json.EmptyObject; return json[object]; @@ -532,7 +532,7 @@ if( m_json.length == 0 ) return; try { - logTrace("writeDubJson"); + logDebug("writeDubJson"); auto dubpath = m_root~".dub"; if( !exists(dubpath.toNativeString()) ) mkdir(dubpath.toNativeString()); auto dstFile = openFile((dubpath~"dub.json").toString(), FileMode.CreateTrunc); @@ -668,7 +668,7 @@ if( are_paths ){ auto p = Path(var); if( !p.absolute ){ - logTrace("Fixing relative path: %s ~ %s", project_path, p.toNativeString()); + logDebug("Fixing relative path: %s ~ %s", project_path, p.toNativeString()); p = Path(project_path) ~ p; } dst.put(p.toNativeString()); diff --git a/source/dub/registry.d b/source/dub/registry.d index 6bfa479..99260c2 100644 --- a/source/dub/registry.d +++ b/source/dub/registry.d Binary files differ diff --git a/source/dub/utils.d b/source/dub/utils.d index f77adbf..90f06d8 100644 --- a/source/dub/utils.d +++ b/source/dub/utils.d @@ -77,7 +77,7 @@ void runCommands(string[] commands, string[string] env = null) { foreach(cmd; commands){ - logDebug("Running %s", cmd); + logDiagnostic("Running %s", cmd); Pid pid; if( env !is null ) pid = spawnShell(cmd, env); else pid = spawnShell(cmd); @@ -95,7 +95,7 @@ void download(string url, string filename) { auto conn = setupHTTPClient(); - logTrace("Storing %s...", url); + logDebug("Storing %s...", url); std.net.curl.download(url, filename, conn); } /// ditto @@ -107,7 +107,7 @@ char[] download(string url) { auto conn = setupHTTPClient(); - logTrace("Getting %s...", url); + logDebug("Getting %s...", url); return get(url, conn); } /// ditto