Skip to content

Commit d5a2215

Browse files
committed
[main] use hadd-style logging in rootls
1 parent 6a7cb31 commit d5a2215

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

main/src/rootls.cxx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <string>
2323
#include <vector>
2424

25+
#include "logging.hxx"
2526
#include "optparse.hxx"
2627
#include "wildcards.hpp"
2728

@@ -107,12 +108,6 @@ positional arguments:
107108
Display contents of the ROOT file 'example.root', traversing recursively any TDirectory.
108109
)";
109110

110-
static ROOT::RLogChannel &RootLsChannel()
111-
{
112-
static ROOT::RLogChannel sLog("ROOTLS");
113-
return sLog;
114-
}
115-
116111
static bool ClassInheritsFrom(const char *class_, const char *baseClass)
117112
{
118113
const auto *cl = TClass::GetClass(class_);
@@ -385,7 +380,7 @@ static void PrintNodesDetailed(std::ostream &stream, const RootLsTree &tree,
385380
const auto &desc = reader->GetDescriptor();
386381
PrintRNTuple(stream, desc, indent + 2, desc.GetFieldZero());
387382
} else {
388-
R__LOG_ERROR(RootLsChannel()) << "failed to read RNTuple object: " << child.fName;
383+
Err() << "failed to read RNTuple object: " << child.fName;
389384
}
390385
}
391386
}
@@ -691,7 +686,7 @@ static RootLsArgs ParseArgs(const char **args, int nArgs)
691686

692687
opts.Parse(args, nArgs);
693688
for (const auto &err : opts.GetErrors())
694-
R__LOG_ERROR(RootLsChannel()) << err;
689+
Err() << err;
695690

696691
if (opts.GetSwitch("help")) {
697692
outArgs.fPrintUsageAndExit = RootLsArgs::EPrintUsage::kLong;
@@ -745,6 +740,8 @@ int main(int argc, char **argv)
745740
// Ignore diagnostics up to (but excluding) kError to avoid spamming users with TClass::Init warnings.
746741
gErrorIgnoreLevel = kError;
747742

743+
InitLog("rootls");
744+
748745
auto args = ParseArgs(const_cast<const char **>(argv) + 1, argc - 1);
749746
if (args.fPrintUsageAndExit != RootLsArgs::EPrintUsage::kNo) {
750747
std::cerr << "usage: rootls [-1hltr] FILE [FILE ...]\n";

0 commit comments

Comments
 (0)