示例#1
0
        /// <summary>
        /// Get the text that has been logged so far. It doesn't clear the log. Use the Clear() function to clear the log.
        /// </summary>
        /// <returns>Text that has been logged.</returns>
        public String GetLog()
        {
            int    size   = TfInvoke.tfeLogListenerSinkGetLogSize(_ptr);
            IntPtr buffer = Marshal.AllocHGlobal(size + 1024); //Add 1024 bytes as extra buffer

            TfInvoke.tfeLogListenerSinkGet(_ptr, buffer);
            String msg = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(buffer);

            Marshal.FreeHGlobal(buffer);
            return(msg);
        }