Exemple #1
0
        /// 输出日志
        void Group::log(
            Module const & module, 
            size_t level, 
            Record const & record)
        {
            Context & ctx = manager_.context();
            ctx.reset(module, (LevelEnum)level);
            size_t len = record.format_message(ctx.msg_buf(), ctx.msg_len());
            ctx.msg_len(len);
            size_t count = mi_other;
            char const * buf = record.other_buffer(len);
            if (buf) {
                ctx[mi_other].buf = buf;
                ctx[mi_other].len = len;
                count = mi_max;
            }

            StreamNode * cur = streams_;
            while (cur && cur->stream->level_ >= level) {
                cur->stream->write(ctx.buffers(), count);
                cur = cur->next;
            }
        }