def format(self, msg, *args, **kwargs):
        """
        Format msg for output if needed
        This is used instead of process() since process() applies to _all_ messages, including debug calls
        """
        if self.extra is None:
            return f"{msg}", kwargs

        if "module_name" in self.extra.keys():
            if len(self.extra["module_name"]) > 8:
                self.extra["module_name"] = self.extra["module_name"][:8] + "..."

        # If the logger is being called when hooking the 'options' module function
        if len(self.extra) == 1 and ("module_name" in self.extra.keys()):
            return (
                f"{colored(self.extra['module_name'], 'cyan', attrs=['bold']):<64} {msg}",
                kwargs,
            )

        # If the logger is being called from CMEServer
        if len(self.extra) == 2 and ("module_name" in self.extra.keys()) and ("host" in self.extra.keys()):
            return (
                f"{colored(self.extra['module_name'], 'cyan', attrs=['bold']):<24} {self.extra['host']:<39} {msg}",
                kwargs,
            )

        # If the logger is being called from a protocol
        if "module_name" in self.extra.keys():
            module_name = colored(self.extra["module_name"], "cyan", attrs=["bold"])
        else:
            module_name = colored(self.extra["protocol"], "blue", attrs=["bold"])

        return (
            f"{module_name:<24} {self.extra['host']:<15} {self.extra['port']:<6} {self.extra['hostname'] if self.extra['hostname'] else 'NONE':<16} {msg}",
            kwargs,
        )

        Format msg for output if needed
        This is used instead of process() since process() applies to _all_ messages, including debug calls
        
cme/logger.py