WSEnableLoggingStream (C 函数)

int WSEnableLoggingStream ( WSLINK l )

启用一个之前由 WSDisableLoggingStream() 禁用的,由 l 指定的 WSTP 连接的登录.

更多信息

  • 如果 l 之前没有用 WSLogStreamToFile() 登录激活,WSEnableLoggingStream() 会激活登录机制.
  • WSDisableLoggingStream()WSEnableLoggingStream() 作为一个 API 机制切换开关启用和禁用登录一个链接.
  • WSEnableLoggingStream() 如果出错,则返回0,成功则返回一个非零值.
  • WSTP 的标头文件 wstp.h 已对 WSEnableLoggingStream() 作出声明.

范例

基本范例  (1)

#include "wstp.h"

int main(int argc, char **argv)
{
    WSENV env;
    WSLINK link;
    int error;
    int apiResult;

    env = WSInitialize((WSEnvironmentParameter)0);
    if(env == (WSENV)0)
    { /* Unable to create WSTP environment object */ }

    link = WSOpenArgcArgv(env, argc, argv, &error)l;
    if(link == (WSLINK)0 || error != WSEOK)
    { /* Unable to create link object */ }

    WSActivate(link);

    /* ... */

    apiResult = WSLogStreamToFile(link, "/path/to/logFile.log");
    { /* unable to log to logFile.log */ }

    /* ... */

    apiResult = WSDisableLoggingStream(link);
    { /* error disabling logging to log file */ }

    /* ... */

    apiResult = WSEnableLoggingStream(link);
    { /* error re-enabling logging */ }

    /* ... */

    apiResult = WSStopLoggingStream(link);
    { /* error shutting down logging */ }

    WSClose(link);

    WSDeinitialize(env);
}