| 33 | namespace |
| 34 | { |
| 35 | std::shared_ptr<IChannel> MakeChannel() |
| 36 | { |
| 37 | GlobalPolicy::Get().SetSubsystem(Subsystem::IntelPresentmon); |
| 38 | // make the channel instance |
| 39 | auto pChannel = std::make_shared<Channel>(); |
| 40 | // error resolver |
| 41 | auto pErrorResolver = std::make_shared<ErrorCodeResolver>(); |
| 42 | pErrorResolver->AddProvider(std::make_unique<win::HrErrorCodeProvider>()); |
| 43 | // error resolving policy |
| 44 | auto pErrPolicy = std::make_shared<ErrorCodeResolvePolicy>(); |
| 45 | pErrPolicy->SetResolver(std::move(pErrorResolver)); |
| 46 | pChannel->AttachComponent(std::move(pErrPolicy)); |
| 47 | // make and add the line-tracking policy |
| 48 | pChannel->AttachComponent(std::make_shared<LinePolicy>()); |
| 49 | // make the formatter |
| 50 | const auto pFormatter = std::make_shared<TextFormatter>(); |
| 51 | // attach drivers |
| 52 | // TODO: test if cwd is writeable, if not write to some other location (temp?) |
| 53 | pChannel->AttachComponent(std::make_shared<MsvcDebugDriver>(pFormatter), "drv:dbg"); |
| 54 | const auto pFileStrategy = std::make_shared<SimpleFileStrategy>(std::format("pmui-init-log-{}.txt", GetCurrentProcessId())); |
| 55 | pChannel->AttachComponent(std::make_shared<BasicFileDriver>(pFormatter, pFileStrategy), "drv:file"); |
| 56 | |
| 57 | return pChannel; |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | // this is injected into to util::log namespace and hooks into that system |
nothing calls this directly
no test coverage detected