OpenersNotesSection(Spacer1)Details

If l had not previously activated logging with (NonWLLink[WSLogStreamToFile(), paclet:ref/c/WSLogStreamToFile]), WSEnableLoggingStream() activates the logging mechanism.

(NonWLLink[WSDisableLoggingStream(), paclet:ref/c/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 (RefLink[wstp.h, paclet:ref/file/wstp.h]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)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);
}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[WSDisableLoggingStream(), paclet:ref/c/WSDisableLoggingStream])  ▪  (NonWLLink[WSLogStreamToFile(), paclet:ref/c/WSLogStreamToFile])  ▪  (NonWLLink[WSStopLoggingStream(), paclet:ref/c/WSStopLoggingStream])  ▪  (NonWLLink[WSStopLoggingStreamToFile(), paclet:ref/c/WSStopLoggingStreamToFile])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[WSTP C API Developer Guide (Mac OS X), paclet:tutorial/WSTPDeveloperGuide-MacintoshOverview])}, {▪(RefLinkPlain[WSTP C API Developer Guide (Unix and Linux), paclet:tutorial/WSTPDeveloperGuide-UnixOverview])}, {▪(RefLinkPlain[WSTP C API Developer Guide (Windows), paclet:tutorial/WSTPDeveloperGuide-WindowsOverview])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Alphabetical Listing of WSTP C Functions, paclet:guide/AlphabeticalListingOfWSTPCFunctions])}, {▪(RefLinkPlain[WSTP C Language Functions, paclet:guide/WSTPCLanguageFunctions])}})}})