Logging Function Specification
Interested in Development?
Project EAUploader is always looking for development members! Even if you just want to talk to us! Please visit our project’s Discord server. Join here
Overview
The logging function outputs a series of internal operations of EAUploader to a log file, providing developers with an easy way to view them. This feature is provided to facilitate faster troubleshooting by developers.
This feature is implemented in EAUploader.UI.Windows.Logger (Editor/Resources/UI/Windows/Logger.cs). This document is based on EAUploader v1.6.2.
Terminology
- Log File GUID: Refers to the GUID assigned by EAUploader to each log file, which is used by developers to identify the submitted log file.
- EAU Log: Refers to logs that are of the EAU log type.
- EAU Log Output Method: Refers to the method used to output EAU logs.
This feature provides the following functionalities.
Logging Function
Start and End Triggers for Logging Function
While EAUploader is running, logs are continuously outputted.
Logging Scope
All logs displayed in the Unity Console are outputted to the log file. Additionally, logs are also outputted when the EAU log output method is called.
Log File Format and Storage Location
The log files generated by this feature are stored in the EAUploaderLog folder directly under the Unity project folder.
The maximum capacity for log files stored in the EAUploaderLog folder is 100MB. If the log file size exceeds 100MB and an attempt is made to append logs, the oldest log files will be deleted.
In the implementation, every time a log is appended, the total size of the *.log files in the folder is checked, and if it exceeds 100MB, the single log file with the oldest creation time is deleted. Because this check runs on every append, older log files are effectively deleted until the size falls below 100MB.
The unit of log file output is from EAUploader startup to EAUploader shutdown. The naming format for log files is YYYY-MM-DD-1.log. YYYY-MM-DD represents the date (in UTC) when the log file was generated, and -[number] represents the number of times EAUploader was started on the same day. For example, a log file named 2024-04-22-3.log indicates that it was generated during the third startup of EAUploader on April 22, 2024.
In the implementation, the smallest number not used by any log file of the same day is used. “Startup of EAUploader” refers to when Unity starts and when scripts are recompiled (domain reload).
Logs Outputted during EAUploader Startup
During EAUploader startup, environment information, date (in UTC), and the log file GUID are outputted. The output is as follows.
EAUploader is starting...*** Environment Details ***Date: 2024-04-22Log GUID: 0123456789abcdef0123456789abcdefApplication-Version: 1.6.2Unity-Version: 2022.3.22f1Editor-Platform: WindowsEditorVpm-Dependency:...*** Environment Details ***Vpm-Dependency lists the packages and versions listed in locked of Packages/vpm-manifest.json.
Log Output Format
Logs are outputted in the following format:
02:42:42.345 [LOG_TYPE] [LOG_MESSAGE] [LOG_TRACELOG]
The items are separated by half-width spaces, and [ ] is not outputted.
- Timestamp
- Outputs the time (in UTC) when the log was generated in the format hh:mm:ss .fff.
- LOG_TYPE
- Represents the log type. The types are as follows:
- LOG: Normal log. General log level.
- WNG: Warning log.
- ERR: Error log.
- EXP: Exception log.
- AST: Assert log.
- EAU: EAU log.
- OTHER: Any other log.
- Represents the log type. The types are as follows:
- LOG_MESSAGE
- The body of the log message.
- LOG_TRACELOG
- The location where the log was outputted. For ERR and EXP, the trace log is displayed.
- For ERR and EXP, the entire trace log is outputted. From the second line on, an indent the length of the timestamp and other items is added for readability.
- For EAU, the third line of the trace log (the caller of the EAU log output method) is outputted.
- Otherwise, the second line of the trace log (the caller of the log) is outputted.
EAU Log Output Method
When the EAU log output method is called, an EAU log is outputted. EAU logs are used to record the operations of EAUploader in the log file.
The EAU log output method is EAUploader.UI.Windows.Logger.writeEAULog.
using EAULogger = EAUploader.UI.Windows.Logger;
EAULogger.writeEAULog("Selected setup tab.");This method calls Debug.Log with an identifier indicating an EAU log prepended to the message. The logging process identifies EAU logs by this identifier and writes the message to the log file with the identifier removed.
Currently, tab switching operations are outputted as EAU logs.
Error Report Window
When a log of type ERR or EXP is received and showErrorReportWindow in the settings file is enabled, the error report window is shown. It is shown as a modal inside EAUploader’s main window.
The error report window shows the following.
- Error logs that occurred since EAUploader started (date and time, message, trace log)
- Environment information (EAUploader version, Unity version, platform, list of VPM packages)
To keep UI Toolkit text rendering stable, up to 200,000 characters of error logs are kept, and only the latest 40,000 characters are shown. When the display is truncated, a notice is shown. Errors that occur while the error report is being shown do not show the error report again (recursion guard).
The error report window has the following items.
- ”Do not show this window again”: When checked, disables
showErrorReportWindow. It can be re-enabled with “Show error report window” in “Settings” on the Avatar List. - Restart: Re-imports
Packages/tech.uslog.eauploaderand restarts EAUploader. - Copy: Copies the contents of the error report to the clipboard.
- OK: Closes the error report window.
Note that the error report window is also shown for error logs outputted by things other than EAUploader. To check its behavior, you can use “Window” → “Error Report” in the menu (outputs a test error log).
Log Report Display Function
Users can open the log file storage folder (EAUploaderLog) with the “Open log report” button shown in “Settings” on the Avatar List.
When the “Open log report” button is pressed, a dialog saying that the folder where the log files are stored has been opened is shown, and the log file storage folder is opened in the OS file browser.
Log Report Sending Function (Suspended)
Sending is currently not available. The following is the specification of the sending function.
Trigger for Sending Function
Users can send log files to developers by clicking the “View Log Report” button displayed on the home screen. In this feature, the latest log file in the log folder will be sent.
Transition to Sending Function Screen
After clicking the “View Log Report” button, a dialog box will be displayed to confirm whether the user wants to send the log file.
If the user clicks the button indicating the intention to send in the aforementioned dialog box, the log file sending process will be executed. If the user closes the dialog box by clicking the “X” button, the log file sending process will not be executed, and the user will be redirected to the home screen.
If the log file sending process is successful, the user will be shown a completion message and the log file GUID. If the log file sending process fails, the user will be shown a message indicating the failure.