WSStopLoggingStreamToFile (C Function)

int WSStopLoggingStreamToFile(WSLINK l, const char *n)

disables logging of the stream activity for the WSTP connection specified by l to the file named by n.

Details

  • WSStopLoggingStreamToFile() closes the file named by n.
  • WSStopLoggingStreamToFile() only disables logging to the file named by n for l. If l logs to more than one file in a given session, WSTP will continue to log events to those files.
  • WSStopLoggingStreamToFile() returns 0 on error and a nonzero value on success.
  • WSStopLoggingStreamToFile() 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);
    if(link == (WSLINK)0 || error != WSEOK)
    { /* Unable to create the WSTP link object */ }

    WSActivate(link);

    apiResult = WSLogStreamToFile(link, "/tmp/link.log");
    { /* Unable to log to link.log */ }

    apiResult = WSLogStreamToFile(link, "/path/to/another/link.log");
    { /* Unable to log to the other link.log */ }

    /* ... */

    apiResult = WSStopLoggingStreamToFile(link, "/tmp/link.log");
    { /* Error while disabling logging */ }

    /* ... */

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

    WSClose(link);
    WSDeinitialize(env);
}