private static bool TryGetBlobLogStreamWriter(string blobDir, Uri engineUri, TraceSource trace, out string blobLogPath, out StreamWriter stream)
                    {
                        var dt = DateTime.UtcNow;

                        blobLogPath = dt.ToString("'blobs_'yyyyMMdd'_'HHmmssfff'.log'", CultureInfo.InvariantCulture);
                        stream      = default;

#pragma warning disable CA1031 // Do not catch general exception types. (By design; we don't want to take an engine down due to failed blob logging.)
                        try
                        {
                            if (blobDir != null)
                            {
                                var qeEncoded     = Uri.EscapeDataString(engineUri.ToCanonicalString());
                                var blobDirWithQe = Path.Combine(blobDir, qeEncoded);
                                if (!Directory.Exists(blobDirWithQe))
                                {
                                    Directory.CreateDirectory(blobDirWithQe);
                                }

                                blobLogPath = Path.Combine(blobDirWithQe, blobLogPath);
                            }

                            stream = File.CreateText(blobLogPath);

                            trace.BlobLogs_Created(blobLogPath, engineUri);

                            return(true);
                        }
                        catch (Exception ex)
                        {
                            trace.BlobLogs_CreateFailed(blobLogPath, engineUri, ex);
                        }
#pragma warning restore CA1031

                        return(false);
                    }