sandesh cpp generator does not recognize the severity annotation

Bug #1801632 reported by yong sheng gong
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenContrail
New
Undecided
Unassigned

Bug Description

void t_cpp_generator::generate_sandesh_trace(ofstream& out,
                                             t_sandesh* tsandesh) {
    std::string creator_name = "trace_sandesh";
    indent(out) << "void " << tsandesh->get_name() << "::TraceMsg" <<
            generate_sandesh_no_static_const_string_function(tsandesh, true, false, true) <<
            " {" << endl;
    indent_up();
    out << indent() << "TraceSandeshType *trace = " <<
            "TraceSandeshType::GetInstance();" << endl;
    out << indent() << "if (trace != NULL && trace->IsTraceOn() && trace_buf->IsTraceOn()) {" << endl;
    indent_up();
    out << indent() << tsandesh->get_name() << " *" << creator_name << " = " <<
            "new " << tsandesh->get_name() <<
            generate_sandesh_no_static_const_string_function(tsandesh, false, false, false, false, true) <<
            ";" << endl;
    out << indent() << creator_name << "->set_category(trace_buf->Name());" << endl;
    /** We should add codes to set the log level according to sandish definition of the type
     for example:
    out << indent() << creator_name << "->set_level(SandeshLevel::SYS_DEBUG);" << endl;
**/
    out << indent() << "uint32_t seqnum(trace_buf->GetNextSeqNum());" << endl;
    out << indent() << creator_name << "->set_seqnum(seqnum);" << endl;
    out << indent() << "trace_buf->TraceWrite(" << creator_name << ");" << endl;
    out << indent() << "if ((IsLocalLoggingEnabled() && IsTracePrintEnabled()) || IsUnitTest()) " << creator_name << "->Log();" << endl;
    indent_down();
    out << indent() << "}" <<endl;
    indent_down();
    indent(out) <<
            "}" << endl << endl;
}

Revision history for this message
yong sheng gong (gongysh) wrote :

t_doc_generator::sandesh_level::type t_doc_generator::get_sandesh_level(
    t_sandesh* tsandesh) {
    string content = get_doc_member(tsandesh, "severity");
    if (content != "")
 return string_to_sandesh_level(content);
    return sandesh_level::INVALID;
}

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.