diff --git a/tools/binman/bintool.py b/tools/binman/bintool.py
index 7a0c816..4bc3cfe 100644
--- a/tools/binman/bintool.py
+++ b/tools/binman/bintool.py
@@ -267,7 +267,7 @@
         name = os.path.expanduser(self.name)  # Expand paths containing ~
         all_args = (name,) + args
         env = tools.get_env_with_path()
-        tout.Detail(f"bintool: {' '.join(all_args)}")
+        tout.detail(f"bintool: {' '.join(all_args)}")
         result = command.run_pipe(
             [all_args], capture=True, capture_stderr=True, env=env,
             raise_on_error=False, binary=binary)
@@ -278,17 +278,17 @@
             # try to run it (as above) since RunPipe() allows faking the tool's
             # output
             if not any([result.stdout, result.stderr, tools.tool_find(name)]):
-                tout.Info(f"bintool '{name}' not found")
+                tout.info(f"bintool '{name}' not found")
                 return None
             if raise_on_error:
-                tout.Info(f"bintool '{name}' failed")
+                tout.info(f"bintool '{name}' failed")
                 raise ValueError("Error %d running '%s': %s" %
                                 (result.return_code, ' '.join(all_args),
                                 result.stderr or result.stdout))
         if result.stdout:
-            tout.Debug(result.stdout)
+            tout.debug(result.stdout)
         if result.stderr:
-            tout.Debug(result.stderr)
+            tout.debug(result.stderr)
         return result
 
     def run_cmd(self, *args, binary=False):
diff --git a/tools/binman/control.py b/tools/binman/control.py
index 305f14b..a179f78 100644
--- a/tools/binman/control.py
+++ b/tools/binman/control.py
@@ -99,9 +99,9 @@
     return result
 
 def _ShowBlobHelp(path, text):
-    tout.Warning('\n%s:' % path)
+    tout.warning('\n%s:' % path)
     for line in text.splitlines():
-        tout.Warning('   %s' % line)
+        tout.warning('   %s' % line)
 
 def _ShowHelpForMissingBlobs(missing_list):
     """Show help for each missing blob to help the user take action
@@ -259,14 +259,14 @@
         entry = image.FindEntryPath(entry_paths[0])
         data = entry.ReadData(decomp, alt_format)
         tools.write_file(output_fname, data)
-        tout.Notice("Wrote %#x bytes to file '%s'" % (len(data), output_fname))
+        tout.notice("Wrote %#x bytes to file '%s'" % (len(data), output_fname))
         return
 
     # Otherwise we will output to a path given by the entry path of each entry.
     # This means that entries will appear in subdirectories if they are part of
     # a sub-section.
     einfos = image.GetListEntries(entry_paths)[0]
-    tout.Notice('%d entries match and will be written' % len(einfos))
+    tout.notice('%d entries match and will be written' % len(einfos))
     for einfo in einfos:
         entry = einfo.entry
         data = entry.ReadData(decomp, alt_format)
@@ -279,7 +279,7 @@
             if fname and not os.path.exists(fname):
                 os.makedirs(fname)
             fname = os.path.join(fname, 'root')
-        tout.Notice("Write entry '%s' size %x to '%s'" %
+        tout.notice("Write entry '%s' size %x to '%s'" %
                     (entry.GetPath(), len(data), fname))
         tools.write_file(fname, data)
     return einfos
@@ -328,7 +328,7 @@
             of the entries), False to raise an exception
         write_map: True to write a map file
     """
-    tout.Info('Processing image')
+    tout.info('Processing image')
     ProcessImage(image, update_fdt=True, write_map=write_map,
                  get_contents=False, allow_resize=allow_resize)
 
@@ -336,7 +336,7 @@
 def WriteEntryToImage(image, entry, data, do_compress=True, allow_resize=True,
                       write_map=False):
     BeforeReplace(image, allow_resize)
-    tout.Info('Writing data to %s' % entry.GetPath())
+    tout.info('Writing data to %s' % entry.GetPath())
     ReplaceOneEntry(image, entry, data, do_compress, allow_resize)
     AfterReplace(image, allow_resize=allow_resize, write_map=write_map)
 
@@ -361,7 +361,7 @@
     Returns:
         Image object that was updated
     """
-    tout.Info("Write entry '%s', file '%s'" % (entry_path, image_fname))
+    tout.info("Write entry '%s', file '%s'" % (entry_path, image_fname))
     image = Image.FromFile(image_fname)
     entry = image.FindEntryPath(entry_path)
     WriteEntryToImage(image, entry, data, do_compress=do_compress,
@@ -399,7 +399,7 @@
             raise ValueError('Must specify exactly one entry path to write with -f')
         entry = image.FindEntryPath(entry_paths[0])
         data = tools.read_file(input_fname)
-        tout.Notice("Read %#x bytes from file '%s'" % (len(data), input_fname))
+        tout.notice("Read %#x bytes from file '%s'" % (len(data), input_fname))
         WriteEntryToImage(image, entry, data, do_compress=do_compress,
                           allow_resize=allow_resize, write_map=write_map)
         return
@@ -408,7 +408,7 @@
     # This means that files must appear in subdirectories if they are part of
     # a sub-section.
     einfos = image.GetListEntries(entry_paths)[0]
-    tout.Notice("Replacing %d matching entries in image '%s'" %
+    tout.notice("Replacing %d matching entries in image '%s'" %
                 (len(einfos), image_fname))
 
     BeforeReplace(image, allow_resize)
@@ -416,19 +416,19 @@
     for einfo in einfos:
         entry = einfo.entry
         if entry.GetEntries():
-            tout.Info("Skipping section entry '%s'" % entry.GetPath())
+            tout.info("Skipping section entry '%s'" % entry.GetPath())
             continue
 
         path = entry.GetPath()[1:]
         fname = os.path.join(indir, path)
 
         if os.path.exists(fname):
-            tout.Notice("Write entry '%s' from file '%s'" %
+            tout.notice("Write entry '%s' from file '%s'" %
                         (entry.GetPath(), fname))
             data = tools.read_file(fname)
             ReplaceOneEntry(image, entry, data, do_compress, allow_resize)
         else:
-            tout.Warning("Skipping entry '%s' from missing file '%s'" %
+            tout.warning("Skipping entry '%s' from missing file '%s'" %
                          (entry.GetPath(), fname))
 
     AfterReplace(image, allow_resize=allow_resize, write_map=write_map)
@@ -488,7 +488,7 @@
             else:
                 skip.append(name)
         images = new_images
-        tout.Notice('Skipping images: %s' % ', '.join(skip))
+        tout.notice('Skipping images: %s' % ', '.join(skip))
 
     state.Prepare(images, dtb)
 
@@ -574,7 +574,7 @@
         if sizes_ok:
             break
         image.ResetForPack()
-    tout.Info('Pack completed after %d pass(es)' % (pack_pass + 1))
+    tout.info('Pack completed after %d pass(es)' % (pack_pass + 1))
     if not sizes_ok:
         image.Raise('Entries changed size after packing (tried %s passes)' %
                     passes)
@@ -585,20 +585,20 @@
     missing_list = []
     image.CheckMissing(missing_list)
     if missing_list:
-        tout.Warning("Image '%s' is missing external blobs and is non-functional: %s" %
+        tout.warning("Image '%s' is missing external blobs and is non-functional: %s" %
                      (image.name, ' '.join([e.name for e in missing_list])))
         _ShowHelpForMissingBlobs(missing_list)
     faked_list = []
     image.CheckFakedBlobs(faked_list)
     if faked_list:
-        tout.Warning(
+        tout.warning(
             "Image '%s' has faked external blobs and is non-functional: %s" %
             (image.name, ' '.join([os.path.basename(e.GetDefaultFilename())
                                    for e in faked_list])))
     missing_bintool_list = []
     image.check_missing_bintools(missing_bintool_list)
     if missing_bintool_list:
-        tout.Warning(
+        tout.warning(
             "Image '%s' has missing bintools and is non-functional: %s" %
             (image.name, ' '.join([os.path.basename(bintool.name)
                                    for bintool in missing_bintool_list])))
@@ -629,7 +629,7 @@
 
     if args.cmd in ['ls', 'extract', 'replace', 'tool']:
         try:
-            tout.Init(args.verbosity)
+            tout.init(args.verbosity)
             tools.prepare_output_dir(None)
             if args.cmd == 'ls':
                 ListEntries(args.image, args.paths)
@@ -682,7 +682,7 @@
         args.indir.append(board_pathname)
 
     try:
-        tout.Init(args.verbosity)
+        tout.init(args.verbosity)
         elf.debug = args.debug
         cbfs_util.VERBOSE = args.verbosity > 2
         state.use_fake_dtb = args.fake_dtb
@@ -724,13 +724,13 @@
                 elf.UpdateFile(*elf_params, data)
 
             if invalid:
-                tout.Warning("\nSome images are invalid")
+                tout.warning("\nSome images are invalid")
 
             # Use this to debug the time take to pack the image
             #state.TimingShow()
         finally:
             tools.finalise_output_dir()
     finally:
-        tout.Uninit()
+        tout.uninit()
 
     return 0
diff --git a/tools/binman/elf.py b/tools/binman/elf.py
index 47e0a3f..bc4966e 100644
--- a/tools/binman/elf.py
+++ b/tools/binman/elf.py
@@ -185,7 +185,7 @@
                 value = -1
                 pack_string = pack_string.lower()
             value_bytes = struct.pack(pack_string, value)
-            tout.Debug('%s:\n   insert %s, offset %x, value %x, length %d' %
+            tout.debug('%s:\n   insert %s, offset %x, value %x, length %d' %
                        (msg, name, offset, value, len(value_bytes)))
             entry.data = (entry.data[:offset] + value_bytes +
                         entry.data[offset + sym.size:])
@@ -350,7 +350,7 @@
                    mem_end - data_start)
 
 def UpdateFile(infile, outfile, start_sym, end_sym, insert):
-    tout.Notice("Creating file '%s' with data length %#x (%d) between symbols '%s' and '%s'" %
+    tout.notice("Creating file '%s' with data length %#x (%d) between symbols '%s' and '%s'" %
                 (outfile, len(insert), len(insert), start_sym, end_sym))
     syms = GetSymbolFileOffset(infile, [start_sym, end_sym])
     if len(syms) != 2:
@@ -368,4 +368,4 @@
     newdata += insert + tools.get_bytes(0, size - len(insert))
     newdata += data[syms[end_sym].offset:]
     tools.write_file(outfile, newdata)
-    tout.Info('Written to offset %#x' % syms[start_sym].offset)
+    tout.info('Written to offset %#x' % syms[start_sym].offset)
diff --git a/tools/binman/elf_test.py b/tools/binman/elf_test.py
index 0f749ee..47ebfba 100644
--- a/tools/binman/elf_test.py
+++ b/tools/binman/elf_test.py
@@ -172,7 +172,7 @@
     def testDebug(self):
         """Check that enabling debug in the elf module produced debug output"""
         try:
-            tout.Init(tout.DEBUG)
+            tout.init(tout.DEBUG)
             entry = FakeEntry(20)
             section = FakeSection()
             elf_fname = self.ElfTestFile('u_boot_binman_syms')
@@ -180,7 +180,7 @@
                 syms = elf.LookupAndWriteSymbols(elf_fname, entry, section)
             self.assertTrue(len(stdout.getvalue()) > 0)
         finally:
-            tout.Init(tout.WARNING)
+            tout.init(tout.WARNING)
 
     def testMakeElf(self):
         """Test for the MakeElf function"""
diff --git a/tools/binman/entry.py b/tools/binman/entry.py
index 07a2713..dc26f8f 100644
--- a/tools/binman/entry.py
+++ b/tools/binman/entry.py
@@ -400,7 +400,7 @@
                 data += tools.get_bytes(0, self.contents_size - new_size)
 
         if not size_ok:
-            tout.Debug("Entry '%s' size change from %s to %s" % (
+            tout.debug("Entry '%s' size change from %s to %s" % (
                 self._node.path, to_hex(self.contents_size),
                 to_hex(new_size)))
         self.SetContents(data)
@@ -489,12 +489,12 @@
     def Info(self, msg):
         """Convenience function to log info referencing a node"""
         tag = "Info '%s'" % self._node.path
-        tout.Detail('%30s: %s' % (tag, msg))
+        tout.detail('%30s: %s' % (tag, msg))
 
     def Detail(self, msg):
         """Convenience function to log detail referencing a node"""
         tag = "Node '%s'" % self._node.path
-        tout.Detail('%30s: %s' % (tag, msg))
+        tout.detail('%30s: %s' % (tag, msg))
 
     def GetEntryArgsOrProps(self, props, required=False):
         """Return the values of a set of properties
@@ -841,7 +841,7 @@
         """
         # Use True here so that we get an uncompressed section to work from,
         # although compressed sections are currently not supported
-        tout.Debug("ReadChildData section '%s', entry '%s'" %
+        tout.debug("ReadChildData section '%s', entry '%s'" %
                    (self.section.GetPath(), self.GetPath()))
         data = self.section.ReadChildData(self, decomp, alt_format)
         return data
@@ -1076,7 +1076,7 @@
         Returns:
             True to use this entry type, False to use the original one
         """
-        tout.Info("Node '%s': etype '%s': %s selected" %
+        tout.info("Node '%s': etype '%s': %s selected" %
                   (node.path, etype, new_etype))
         return True
 
diff --git a/tools/binman/etype/fmap.py b/tools/binman/etype/fmap.py
index 72b44a7..0c57620 100644
--- a/tools/binman/etype/fmap.py
+++ b/tools/binman/etype/fmap.py
@@ -46,7 +46,7 @@
         """
         def _AddEntries(areas, entry):
             entries = entry.GetEntries()
-            tout.Debug("fmap: Add entry '%s' type '%s' (%s subentries)" %
+            tout.debug("fmap: Add entry '%s' type '%s' (%s subentries)" %
                        (entry.GetPath(), entry.etype, to_hex_size(entries)))
             if entries and entry.etype != 'cbfs':
                 # Create an area for the section, which encompasses all entries
diff --git a/tools/binman/etype/section.py b/tools/binman/etype/section.py
index b3d7302..706f6bd 100644
--- a/tools/binman/etype/section.py
+++ b/tools/binman/etype/section.py
@@ -757,28 +757,28 @@
         return self._sort
 
     def ReadData(self, decomp=True, alt_format=None):
-        tout.Info("ReadData path='%s'" % self.GetPath())
+        tout.info("ReadData path='%s'" % self.GetPath())
         parent_data = self.section.ReadData(True, alt_format)
         offset = self.offset - self.section._skip_at_start
         data = parent_data[offset:offset + self.size]
-        tout.Info(
+        tout.info(
             '%s: Reading data from offset %#x-%#x (real %#x), size %#x, got %#x' %
                   (self.GetPath(), self.offset, self.offset + self.size, offset,
                    self.size, len(data)))
         return data
 
     def ReadChildData(self, child, decomp=True, alt_format=None):
-        tout.Debug(f"ReadChildData for child '{child.GetPath()}'")
+        tout.debug(f"ReadChildData for child '{child.GetPath()}'")
         parent_data = self.ReadData(True, alt_format)
         offset = child.offset - self._skip_at_start
-        tout.Debug("Extract for child '%s': offset %#x, skip_at_start %#x, result %#x" %
+        tout.debug("Extract for child '%s': offset %#x, skip_at_start %#x, result %#x" %
                    (child.GetPath(), child.offset, self._skip_at_start, offset))
         data = parent_data[offset:offset + child.size]
         if decomp:
             indata = data
             data = comp_util.decompress(indata, child.compress)
             if child.uncomp_size:
-                tout.Info("%s: Decompressing data size %#x with algo '%s' to data size %#x" %
+                tout.info("%s: Decompressing data size %#x with algo '%s' to data size %#x" %
                             (child.GetPath(), len(indata), child.compress,
                             len(data)))
         if alt_format:
diff --git a/tools/binman/etype/u_boot_spl_expanded.py b/tools/binman/etype/u_boot_spl_expanded.py
index 8e138e6..319f670 100644
--- a/tools/binman/etype/u_boot_spl_expanded.py
+++ b/tools/binman/etype/u_boot_spl_expanded.py
@@ -39,7 +39,7 @@
     @classmethod
     def UseExpanded(cls, node, etype, new_etype):
         val = state.GetEntryArgBool('spl-dtb')
-        tout.DoOutput(tout.INFO if val else tout.DETAIL,
+        tout.do_output(tout.INFO if val else tout.DETAIL,
                       "Node '%s': etype '%s': %s %sselected" %
                       (node.path, etype, new_etype, '' if val else 'not '))
         return val
diff --git a/tools/binman/etype/u_boot_tpl_expanded.py b/tools/binman/etype/u_boot_tpl_expanded.py
index 15cdac4..55fde3c 100644
--- a/tools/binman/etype/u_boot_tpl_expanded.py
+++ b/tools/binman/etype/u_boot_tpl_expanded.py
@@ -39,7 +39,7 @@
     @classmethod
     def UseExpanded(cls, node, etype, new_etype):
         val = state.GetEntryArgBool('tpl-dtb')
-        tout.DoOutput(tout.INFO if val else tout.DETAIL,
+        tout.do_output(tout.INFO if val else tout.DETAIL,
                       "Node '%s': etype '%s': %s %sselected" %
                       (node.path, etype, new_etype, '' if val else 'not '))
         return val
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index f85581c..123fdb1 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -240,7 +240,7 @@
 
     def setUp(self):
         # Enable this to turn on debugging output
-        # tout.Init(tout.DEBUG)
+        # tout.init(tout.DEBUG)
         command.test_result = None
 
     def tearDown(self):
diff --git a/tools/binman/image.py b/tools/binman/image.py
index 93a1d3e..afc4b4d 100644
--- a/tools/binman/image.py
+++ b/tools/binman/image.py
@@ -175,11 +175,11 @@
     def BuildImage(self):
         """Write the image to a file"""
         fname = tools.get_output_filename(self._filename)
-        tout.Info("Writing image to '%s'" % fname)
+        tout.info("Writing image to '%s'" % fname)
         with open(fname, 'wb') as fd:
             data = self.GetPaddedData()
             fd.write(data)
-        tout.Info("Wrote %#x bytes" % len(data))
+        tout.info("Wrote %#x bytes" % len(data))
 
     def WriteMap(self):
         """Write a map of the image to a .map file
@@ -230,7 +230,7 @@
         return entry
 
     def ReadData(self, decomp=True, alt_format=None):
-        tout.Debug("Image '%s' ReadData(), size=%#x" %
+        tout.debug("Image '%s' ReadData(), size=%#x" %
                    (self.GetPath(), len(self._data)))
         return self._data
 
diff --git a/tools/binman/state.py b/tools/binman/state.py
index b27c800..8cd8a48 100644
--- a/tools/binman/state.py
+++ b/tools/binman/state.py
@@ -170,16 +170,16 @@
     global entry_args
 
     entry_args = {}
-    tout.Debug('Processing entry args:')
+    tout.debug('Processing entry args:')
     if args:
         for arg in args:
             m = re.match('([^=]*)=(.*)', arg)
             if not m:
                 raise ValueError("Invalid entry arguemnt '%s'" % arg)
             name, value = m.groups()
-            tout.Debug('   %20s = %s' % (name, value))
+            tout.debug('   %20s = %s' % (name, value))
             entry_args[name] = value
-    tout.Debug('Processing entry args done')
+    tout.debug('Processing entry args done')
 
 def GetEntryArg(name):
     """Get the value of an entry argument
@@ -263,16 +263,16 @@
     """
     global output_fdt_info, main_dtb, fdt_path_prefix
 
-    tout.Info('Preparing device trees')
+    tout.info('Preparing device trees')
     output_fdt_info.clear()
     fdt_path_prefix = ''
     output_fdt_info['fdtmap'] = [image.fdtmap_dtb, 'u-boot.dtb']
     main_dtb = None
-    tout.Info("   Found device tree type 'fdtmap' '%s'" % image.fdtmap_dtb.name)
+    tout.info("   Found device tree type 'fdtmap' '%s'" % image.fdtmap_dtb.name)
     for etype, value in image.GetFdts().items():
         entry, fname = value
         out_fname = tools.get_output_filename('%s.dtb' % entry.etype)
-        tout.Info("   Found device tree type '%s' at '%s' path '%s'" %
+        tout.info("   Found device tree type '%s' at '%s' path '%s'" %
                   (etype, out_fname, entry.GetPath()))
         entry._filename = entry.GetDefaultFilename()
         data = entry.ReadData()
@@ -285,7 +285,7 @@
             image_node = dtb.GetNode('/binman/%s' % image.image_node)
         fdt_path_prefix = image_node.path
         output_fdt_info[etype] = [dtb, None]
-    tout.Info("   FDT path prefix '%s'" % fdt_path_prefix)
+    tout.info("   FDT path prefix '%s'" % fdt_path_prefix)
 
 
 def GetAllFdts():
@@ -384,7 +384,7 @@
         for_repack: True is this property is only needed for repacking
     """
     for n in GetUpdateNodes(node, for_repack):
-        tout.Detail("File %s: Update node '%s' prop '%s' to %#x" %
+        tout.detail("File %s: Update node '%s' prop '%s' to %#x" %
                     (n.GetFdt().name, n.path, prop, value))
         n.SetInt(prop, value)
 
