• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Sholtee / proxygen / 1005

17 Apr 2025 01:11PM UTC coverage: 91.501% (+1.3%) from 90.219%
1005

push

appveyor

Sholtee
greenify tests

5006 of 5471 relevant lines covered (91.5%)

0.92 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

19.23
/SRC/Private/SourceGenerators/ProxyEmbedderBase.Log.cs
1
/********************************************************************************
2
* ProxyEmbedderBase.Log.cs                                                          *
3
*                                                                               *
4
* Author: Denes Solti                                                           *
5
********************************************************************************/
6
using System;
7
using System.Diagnostics;
8
using System.IO;
9
using System.Threading;
10

11
using static System.Environment;
12

13
namespace Solti.Utils.Proxy.Internals
14
{
15
    internal abstract partial class ProxyEmbedderBase
16
    {
17
        //
18
        // SourceGenerator should reference as few dependencies as possible since dependencies must be bundled
19
        // to our sourcegenerator package. That's the reason behind this primitive logging
20
        //
21

22
        internal protected static string? LogException(Exception ex, in CancellationToken cancellation)
23
        {
1✔
24
            string? logDump = null;  // TODO: implement real logging
1✔
25
            if (logDump is not null)
1✔
26
            {
×
27
                string logFile = Path.Combine(logDump, $"ProxyGen_{Guid.NewGuid()}.log");
×
28

29
                Directory.CreateDirectory(logDump);
×
30

31
                try
32
                {
×
33
                    using StreamWriter log = File.CreateText(logFile);
×
34
                    log.AutoFlush = true;
×
35

36
                    for (Exception? current = ex; current is not null; current = current.InnerException)
×
37
                    {
×
38
                        if (current != ex) log.Write($"{NewLine}->{NewLine}", cancellation: cancellation);
×
39
                        log.Write(current.ToString(), cancellation: cancellation);
×
40

41
                        foreach (object? key in current.Data.Keys)
×
42
                        {
×
43
                            log.Write($"{NewLine + key}:{NewLine + current.Data[key]}", cancellation: cancellation);
×
44
                        }
×
45
                    }
×
46

47
                    return logFile;
×
48
                }
49
                catch (IOException exc)
×
50
                {
×
51
                    Trace.TraceWarning($"File ({logFile}) could not be dumped: ${exc.Message}");
×
52
                }
×
53
            }
×
54
            return null;
1✔
55
        }
1✔
56
    }
57
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc