我从 fastify cli 生成了 fastify 项目,然后我真的想使用记录器系统并将其写入文件
下面的代码是我尝试的方法,但是当我发送请求时,它还没有写入任何日志文件,并且系统也不会创建任何文件。
import { join } from 'path';
import AutoLoad, {AutoloadPluginOptions} from 'fastify-autoload';
import { FastifyLoggerOptions, FastifyPluginAsync } from 'fastify';
export type AppOptions = {
// Place your custom options for app below here.
} & Partial<AutoloadPluginOptions> & Partial<FastifyLoggerOptions>;
const app: FastifyPluginAsync<AppOptions> = async (
fastify,
opts
): Promise<void> => {
// Place here your custom code!
opts.level = 'info'
opts.file = 'logger'
fastify.log.info('Test log')
// Do not touch the following lines
// This loads …Run Code Online (Sandbox Code Playgroud) 我用它来圆化 TextBox 的角,
<ControlTemplate x:Key="TextBoxBaseControlTemplate" TargetType="{x:Type TextBoxBase}">
<Border Background="{TemplateBinding Background}"
x:Name="Bd" BorderBrush="#FFE6DDDD"
BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="10">
<ScrollViewer x:Name="PART_ContentHost"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" TargetName="Bd"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
</Trigger>
<Trigger Property="Width" Value="Auto">
<Setter Property="MinWidth" Value="100"/>
</Trigger>
<Trigger Property="Height" Value="Auto">
<Setter Property="MinHeight" Value="20"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
Run Code Online (Sandbox Code Playgroud)
我申请,
<TextBox Template="{StaticResource TextBoxBaseControlTemplate}"
Height="25"
Margin="168,100,139,194"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Background="{x:Null}"
BorderBrush="{x:Null}"
FontFamily="Aller Light">
</TextBox>
Run Code Online (Sandbox Code Playgroud)
任务完成
然后我想在PasswordBox中做,
<ControlTemplate x:Key="passwordbox" TargetType="{x:Type PasswordBox}">
<Border Background="{TemplateBinding Background}"
x:Name="Bd" BorderBrush="#FFE6DDDD"
BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="10">
</Border>
<ControlTemplate.Triggers>
<Trigger …Run Code Online (Sandbox Code Playgroud)