op_prg_log_entry_write_options()

Abstract

Writes a log entry to the specified log handle, with control over which columns are included.

Syntax

op_prg_log_entry_write_options (handle, options, entry_text, …)
Argument Type Description
handle Log_Handle Log handle identifying the simulation log to receive the entry.
options int Options for suppressing columns in the log entry (see options in Details).
entry_text const char * String containing the text of the log entry. The string can contain conversion specifiers like those used by the C printf command (%d, %s, and so on).
… various Zero or more arguments representing values to be substituted into entry_text.

Return Type

Compcode

OPC_COMPCODE_SUCCESS if the entry was added successfully; OPC_COMPCODE_FAILURE otherwise.

Example

/* Failed to load the requested model */
/* Most likely cause is missing model from mod_dirs. */

sprintf (line0_buf, "TMM: unable to load propagation model (%s). ",
	DraS_Closure_Tmm_Prop_Model_Name);
strcpy (line1_buf, "Using default closure instead.");

/* log message, omitting node and event */
op_prg_log_entry_write_options (tmm_problem_log_handle, 
	OPC_LOG_ENTRY_OPTION_NO_NODE | OPC_LOG_ENTRY_OPTION_NO_EVENT,
	"Pipeline stage 'closure' during initialization for\n"
	"%s\n"
	"%s\n"
	"\n"
	"Check that your mod_dirs contains all 3 of the needed\n"
	"propagation model files (.prop.d, .prop.p and .prop.so).\n",
	line0_buf,
	line1_buf);

Details

This KP appends a new log entry to a simulation log. Simulation logs can only be referenced by variables of type Log_Handle that have been initialized with op_prg_log_handle_create().

options

You can omit certain column values from the log entry by using the options argument. options must be either a 0 (to include all columns) or an OR’ed combination of one or more of the following constants:

  • OPC_LOG_ENTRY_OPTION_NO_EVENT
  • OPC_LOG_ENTRY_OPTION_NO_NODE
  • OPC_LOG_ENTRY_OPTION_NO_SEVERITY
  • OPC_LOG_ENTRY_OPTION_NO_TIME

Purpose

Provides a mechanism to write an entry to a specified simulation log. This KP is identical to op_prg_log_entry_write(), except that it also lets you omit selected columns from the log entry.

Errors

  • Recoverable Error: Invalid log handle.
  • Recoverable Error: Nil handle format.
  • Program Abort: Segmentation violation/Bus error. (due to an invalid argument following a string with conversion specifiers)

Reference

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · Documentation compiled and provided by Beijing ZNetLink Technology Co., Ltd.

交流群 · QQ Group:OPNET/智网妙算网络仿真交流群(群号 486383494)

原文档 © 2017 Riverbed Technology · 本站为公益翻译,由 AI 辅助完成,请仔细甄别

Original documentation © 2017 Riverbed Technology. Community translation, AI-assisted. Contact: jiazequn@znetlink.com