Major Update:
- Updated all Logged messages, standardised DebugLevel:
- dlNone - Show startup and stop
- dlLow - Show creation/destruction of Function Blocks and Local IO
- dlMedium - Show connection events, eg. open/close
- dlHigh - Show data flow events
-LogCore:
- LogMessage and ShowOutput uses va_list
only run printf if DebugLevel correct
- Remove global LogStr[] variable
- SelectableCore:
- Implemented Auto-management of handles
auto open on startup/fail/close
- Changed simple Open/Close/Read/Write methods to inline
- Do not set Select Write trigger for server socket
- Memory leak, setting address twice on RemoteClient
- Bug fix, only send handle out data if DebugLevel = dlHigh
- Bug fix, do not Read/ProcessBuffer if no InputBuffer
This commit is contained in:
@@ -18,7 +18,6 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
extern char ProcessName[];
|
||||
extern char LogStr[]; // Access to global temporary log messages string
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -38,8 +37,7 @@ CFunctionCore::CFunctionCore( const char * FunctionName )
|
||||
FirstIO = NULL;
|
||||
|
||||
// Report status
|
||||
sprintf( LogStr, "Function '%s' - Created", FunctionName );
|
||||
LogMessage( ProcessName, dlLow, LogStr );
|
||||
LogMessage( dlLow, "%s: Function '%s' - Created", ProcessName, FunctionName );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -84,8 +82,7 @@ CFunctionCore::~CFunctionCore()
|
||||
}
|
||||
|
||||
// Report status
|
||||
sprintf( LogStr, "Function '%s' - Destroyed", Name );
|
||||
LogMessage( ProcessName, dlLow, LogStr );
|
||||
LogMessage( dlLow, "%s: Function '%s' - Destroyed", ProcessName, Name );
|
||||
|
||||
// Destroy Name
|
||||
if (Name) {
|
||||
@@ -121,8 +118,7 @@ TLocalIO * CFunctionCore::AddLocalIO( const char * IOName )
|
||||
strcpy( (*LocalIO)->Name, IOName );
|
||||
|
||||
// Log Event
|
||||
sprintf( LogStr, "Local IO '%s' - Created", IOName );
|
||||
LogMessage( Name, dlMedium, LogStr );
|
||||
LogMessage( dlLow, "%s: Local IO '%s' - Created", Name, IOName );
|
||||
}
|
||||
|
||||
return *LocalIO;
|
||||
@@ -159,8 +155,7 @@ bool CFunctionCore::AddInput( const char * IOName, CFunctionCore * OutFunction,
|
||||
strcpy( (*LinkedIO)->IOName, OutputName );
|
||||
|
||||
// Log Event
|
||||
sprintf( LogStr, "Input Linked - '%s'/'%s' <-- '%s'/'%s'", Name, IOName, OutFunction->GetName(), OutputName );
|
||||
LogMessage( Name, dlMedium, LogStr );
|
||||
LogMessage( dlLow, "%s: Input Linked - '%s'/'%s' <-- '%s'/'%s'", Name, Name, IOName, OutFunction->GetName(), OutputName );
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -196,8 +191,7 @@ bool CFunctionCore::AddOutput( const char * IOName, CFunctionCore * InFunction,
|
||||
strcpy( (*LinkedIO)->IOName, InputName );
|
||||
|
||||
// Log Event
|
||||
sprintf( LogStr, "Output Linked - '%s'/'%s' --> '%s'/'%s'", Name, IOName, InFunction->GetName(), InputName );
|
||||
LogMessage( Name, dlMedium, LogStr );
|
||||
LogMessage( dlLow, "%s: Output Linked - '%s'/'%s' --> '%s'/'%s'", Name, Name, IOName, InFunction->GetName(), InputName );
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -221,15 +215,12 @@ int CFunctionCore::Input( const char * IOName, const char * Data, int MaxLen )
|
||||
if (!(LocalIO = GetLocalIO( IOName )))
|
||||
{
|
||||
// Log event
|
||||
sprintf( LogStr, "%s: Local IO '%s' - Input rejected, Local IO not found", Name, IOName );
|
||||
LogMessage( Name, dlMedium, LogStr );
|
||||
|
||||
LogMessage( dlHigh, "%s: Local IO '%s' - Input rejected, Local IO not found", Name, IOName );
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Log event
|
||||
sprintf( LogStr, "%s: Local IO '%s' - IN:", Name, IOName );
|
||||
ShowOutput( LogStr, dlMedium, OUT_NORMAL, Data, MaxLen );
|
||||
ShowOutput( dlHigh, OUT_NORMAL, Data, MaxLen, "%s: Local IO '%s' - IN:", Name, IOName );
|
||||
|
||||
// Return processed bytes
|
||||
return MaxLen;
|
||||
@@ -251,14 +242,12 @@ int CFunctionCore::Output( const char * IOName, const char * Data, int Len )
|
||||
if (!(LocalIO = GetLocalIO( IOName )))
|
||||
{
|
||||
// Log Event
|
||||
sprintf( LogStr, "%s: Local IO '%s' - Output rejected, Local IO not found", Name, IOName );
|
||||
LogMessage( Name, dlMedium, LogStr );
|
||||
LogMessage( dlHigh, "%s: Local IO '%s' - Output rejected, Local IO not found", Name, IOName );
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Log event
|
||||
sprintf( LogStr, "%s: Local IO '%s' - OUT:", Name, IOName );
|
||||
ShowOutput( LogStr, dlMedium, OUT_NORMAL, Data, Len );
|
||||
ShowOutput( dlHigh, OUT_NORMAL, Data, Len, "%s: Local IO '%s' - OUT:", Name, IOName );
|
||||
|
||||
// Return processed bytes
|
||||
return Len;
|
||||
|
||||
Reference in New Issue
Block a user