该clang-tidy --dump-config命令产生如下内容:
---
Checks: 'clang-diagnostic-*,clang-analyzer-*'
WarningsAsErrors: ''
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
FormatStyle: none
User: [...]
CheckOptions:
- key: [...]
value: [...]
[...]
Run Code Online (Sandbox Code Playgroud)
该选项的含义是什么AnalyzeTemporaryDtors?设置为 后会发生什么变化true?所有其他选项都有记录,但我找不到与此相关的任何文档,并且我找不到更改该选项值的任何差异。
我目前正在运行一个应用程序,我希望将日志放入文件中,以便 Datadog 能够获取它们。
我目前只使用源生成器来记录,但如何将这些日志记录到文件中?
我尝试更改 web.config 并将其部署到 iis,但似乎没有任何内容记录到文件中,然后我手动创建了日志文件夹,但似乎仍然没有放入任何内容。
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!-- To customize the asp.net core module uncomment and edit the following section.
For more info see https://go.microsoft.com/fwlink/?linkid=838655 -->
<system.webServer>
<handlers>
<remove name="aspNetCore"/>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)
那么我如何将日志保存到文件中呢?
我目前如何登录
public partial class RequestResponseLoggerMiddleware
{
private readonly RequestDelegate _next;
private readonly ILogger _logger;
public RequestResponseLoggerMiddleware(RequestDelegate next,
ILoggerFactory loggerFactory)
{
_next = next;
_logger = loggerFactory
.CreateLogger<RequestResponseLoggerMiddleware>();
}
[LoggerMessage(0, …Run Code Online (Sandbox Code Playgroud) 将[[deprecated]]和__attribute__ ((visibility ("default")))属性与-std=c++14生成错误(根据使用的顺序expected identifier before ‘__attribute__’或不同而不同expected identifier before ‘[’ token)。单独使用它们不会产生错误。
c++11 样式属性[[gnu::visibility("default")]]适用于类,但不适用于函数(代码可以编译,但会产生-Wattributes警告,并且在使用 构建时会忽略符号-fvisibility=hidden)。
这是编译器中的错误(我使用 GCC 6.2 进行这些测试)还是 C++ 标准指定的错误?相同的代码 ( [[deprecated]] __attribute__ ((visibility ("default")))) 使用 clang 按预期工作)。
这是我用于测试的代码,用于组合所有可能性,产生所需结果(不推荐+默认可见性)的唯一情况是 3 和 7,即使用旧样式属性的情况。
foo.h
#if defined(X_VERSION)
# if (X_VERSION % 4) == 0 // 0 4 8 12
# define DEPRECATED [[deprecated]]
# define VISIBILITY [[gnu::visibility("default")]]
# elif (X_VERSION % 4) == 1 // 1 …Run Code Online (Sandbox Code Playgroud) 我想使用C++ 98和g ++编译器将类标记为已弃用,以便在直接使用此类时或者从某个类派生此类时接收警告.
显然,在使用__attribute__ ((__deprecated__))类时使用工作,但不使用继承.
例如:
#if defined(__GNUC__)
# define DEPRECATED __attribute__ ((__deprecated__))
#else
# define DEPRECATED
#endif
class DEPRECATED Foo
{
public:
explicit Foo(int foo) : m_foo(foo) {}
virtual ~Foo() {}
virtual int get() { return m_foo; }
private:
int m_foo;
};
class Bar : public Foo // This declaration does not produce a compiler
// warning.
{
public:
explicit Bar(int bar) : Foo(bar), m_bar(bar) {}
virtual ~Bar() {}
virtual int get() { return m_bar; }
private: …Run Code Online (Sandbox Code Playgroud) c++ ×2
gcc ×2
asp.net-core ×1
c# ×1
c++14 ×1
c++98 ×1
clang-tidy ×1
datadog ×1
deprecated ×1
gcc-warning ×1
logging ×1
ms-yarp ×1
visibility ×1