Search code examples
c#loggingreal-timeperforcep4api.net

how to get real time log via perforce api similar to p4v log


I am facing issue with perforce api (.net), as i am unable to pull sync logs in real time.

- What am I trying to do

I am trying to pull real time logs as Sync is triggered using the
Perforce.P4.Client.SyncFiles() command. Similar to the P4V GUI Logs, which update when we try to sync any files.

- What is happening now

  • As the output is generated only after the command is done execution its not something intended for.

  • Also tried looking into Perforce.P4.P4Server.RunCommand() which does provide detailed report but only after the execution of the command. Looked into this

Reason is -

I am trying to add a status update to the Tool i am working on which shows which Perforce file is currently being sync'd.

Please advise. Thanks in Advance.

-Bharath


Solution

  • In the C++ client API (which is what P4V is built on), the client receives an OutputInfo callback (or OutputStat in tagged mode) for each file as it begins syncing.

    Looking over the .NET documentation I think the equivalents are the P4CallBacks.InfoResultsDelegate and P4CallBacks.TaggedOutputDelegate which handle events like P4Server.InfoResultsReceived etc.