internal RosOutLogger(string typeName, string nodeId, LogLevel logLevel, bool showLevel, bool showDateTime, bool showLogName, string dateTimeFormat)
            : base(typeName, logLevel, showLevel, showDateTime, showLogName, dateTimeFormat)
        {
            _nodeId = nodeId;
            _node   = Ros.GetNodes().FirstOrDefault(x => x.NodeId == _nodeId);

            if (_node != null)
            {
                _publisher = _node.LogPubliser;
            }
        }
        protected override void WriteInternal(LogLevel targetLevel, object message, Exception e)
        {
            var sb = new StringBuilder();

            FormatOutput(sb, targetLevel, message, e);

            if (_node == null)
            {
                _node = Ros.GetNodes().FirstOrDefault(x => x.NodeId == _nodeId);
            }

            LogLevel currentLevel = LogLevel.Info;
            string   nodeId       = "unknown";

            if (_node != null)
            {
                currentLevel = _node.LogLevel.ToLogLevel();
                nodeId       = _node.NodeId;
            }

            if (_publisher == null && _node != null)
            {
                _publisher = _node.LogPubliser;
            }

            if (_publisher != null)
            {
                if (targetLevel >= currentLevel)
                {
                    _publisher.OnNext(new Log()
                    {
                        name  = nodeId,
                        level = currentLevel.ToLogLevel(),
                        msg   = message.ToString()
                    });
                }
            }
        }