WSEnableLoggingStream (C Function)

int WSEnableLoggingStream ( WSLINK l )

enables logging for a WSTP connection specified by l previously disabled by a call to WSDisableLoggingStream().

Details

  • If l had not previously activated logging with WSLogStreamToFile(), WSEnableLoggingStream() activates the logging mechanism.
  • WSDisableLoggingStream() and WSEnableLoggingStream() act as a toggle API mechanism for enabling and disabling logging on a link.
  • WSEnableLoggingStream() returns 0 on error, and a nonzero value on success.
  • WSEnableLoggingStream() is declared in the WSTP header file wstp.h.

Examples

Basic Examples  (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);
}