小编Ego*_*per的帖子

如何在 Fastify 中配置从 fastifify cli 创建的记录器文件

我从 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)

fastify

10
推荐指数
1
解决办法
1274
查看次数

WPF PasswordBox 圆角

我用它来圆化 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)

wpf xaml

0
推荐指数
1
解决办法
3645
查看次数

标签 统计

fastify ×1

wpf ×1

xaml ×1