Jump to content

Recommended Posts

Hey all, who know how you can call this method, using code?
 

copylog.PNG.d6b71ec015d2e4f64a85e52442c0107f.PNG

 

 

Often there is some kind of error in the code, but by the time it is detected, the bot has already closed, and it becomes difficult to find the required log file in the "Logs" folder, when there are thousands of them, if you knew how to call this method, you could make a plugin, allowing you to copy the log when certain errors occur, this would be very useful.

Link to comment
https://wrobot.eu/forums/topic/13665-copy-log-to-desktop-code/
Share on other sites

Hi, it is code:

        private void ButtonCopyLog(object sender, System.Windows.RoutedEventArgs e)
        {
            try
            {
                var logFilePath = $@"{Others.GetCurrentDirectory}\Logs\{Logging.NameCurrentLogFile()}";
                var logCopyDest = $@"{Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)}\{Logging.NameCurrentLogFile()}";
                if (File.Exists(logCopyDest))
                    File.Delete(logCopyDest);
                File.Copy(logFilePath, logCopyDest);
                Logging.Write("[Logging]" + Logging.NameCurrentLogFile() + " copied on your desktop.");
            }
            catch
            {
            }
        }

 

On 11/12/2021 at 2:53 PM, Droidz said:

Hi, it is code:

        private void ButtonCopyLog(object sender, System.Windows.RoutedEventArgs e)
        {
            try
            {
                var logFilePath = $@"{Others.GetCurrentDirectory}\Logs\{Logging.NameCurrentLogFile()}";
                var logCopyDest = $@"{Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)}\{Logging.NameCurrentLogFile()}";
                if (File.Exists(logCopyDest))
                    File.Delete(logCopyDest);
                File.Copy(logFilePath, logCopyDest);
                Logging.Write("[Logging]" + Logging.NameCurrentLogFile() + " copied on your desktop.");
            }
            catch
            {
            }
        }

 

Thank you very much, this is what I need

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...