LogProc
LogProc is a callback function, which the plugin can call to show the FTP connections toolbar, and to pass log messages to it. Totalcmd can show these messages in the log window (ftp toolbar) and write them to a log file. The address of this callback function is received through the
FsInit() function when the plugin is loaded.
Declaration:
void __stdcall LogProc(int PluginNr,int MsgType,char* LogString);
Description of parameters:
PluginNr Here the plugin needs to pass the plugin number received through the
FsInit() function.
MsgType Can be one of the MSGTYPE_XXX flags:
MSGTYPE_CONNECT Connect to a file system requiring disconnect
MSGTYPE_DISCONNECT Disconnected successfully
MSGTYPE_DETAILS Not so important messages like directory changing
MSGTYPE_TRANSFERCOMPLETE A file transfer was completed successfully
MSGTYPE_CONNECTCOMPLETE unused
MSGTYPE_IMPORTANTERROR An important error has occured
MSGTYPE_OPERATIONCOMPLETE An operation other than a file transfer has completed
Total Commander supports logging to files. While one log file will store all messages, the other will only store important errors, connects, disconnects and complete operations/transfers, but not messages of type MSGTYPE_DETAILS.
LogString String which should be logged.
When MsgType==MSGTYPE_CONNECT, the string MUST have a specific format:
"CONNECT" followed by a single whitespace, then the root of the file system which was connected, without trailing backslash. Example: CONNECT \Filesystem
When MsgType==MSGTYPE_TRANSFERCOMPLETE, this parameter should contain both the source and target names, separated by an arrow " -> ", e.g.
Download complete: \Filesystem\dir1\file1.txt -> c:\localdir\file1.txt
Return value:
There is no return value.
Important note:
Do NOT call LogProc with MSGTYPE_CONNECT if your plugin does not require connect/disconnect! If you call it with MsgType==MSGTYPE_CONNECT, the function FsDisconnect will be called (if defined) when the user presses the Disconnect button.
Examples:
- FTP requires connect/disconnect, so call LogProc with MSGTYPE_CONNECT when a connection is established.
- Access to local file systems (e.g. Linux EXT2) does not require connect/disconnect