Skip to main content

Win10打开休眠模式

· One min read

升级正式版 win10 以后,发现竟然没有休眠选项,从电源管理器里面也没有找到,有时候有些重要的工作,希望第二天打开直接在第一天的状态,不用重新打开各种文件,而电脑又没必要开一整夜,于是必需要打开休眠选项。

以管理员权限进入命令行 输入命令:

powercfg /a

查看电脑支持的睡眠模式,是否休眠未打开 如果未打开,然后输入

powercfg /h on

最后再用命令:powercfg /a 查看是否打开了休眠。 如果已经打开了,就可以去电源管理器中去设置了。

在开始菜单上右键,选择电源选项, 选择“选择电源按钮的功能”, 单击“更改当前不可用的设置, 单击“更改当前不可用的设置”, 选择需要的设置“休眠”, 最后 “保存修改” 这样打开开始菜单,选择“电源”现在可以休眠了 --------------------- Refer:https://blog.csdn.net/saindy5828/article/details/72857332

.net core 3.0日志中打印时间 | logging timestamp in .net core

· One min read

“遭万人唾弃”的.net core 在 3.0 中终于可以在日志中打印时间戳了, 一个大家都觉得是炒鸡煎蛋的功能在 github 上挂了 3 年(https://github.com/aspnet/Logging/issues/483).

目前只发现在 Microsoft.Extensions.Logging.Console 中有这么一个 TimestampFormat, 是不是也就意味着只能在 Console Log 中打印时间戳 ?

用法 1, AddConsole 时指定 Format:

    public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}

public IConfiguration Configuration { get; }

// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();
<span style="color: #ff0000;">services.AddLogging(opt =>
{
opt.AddConsole(cfg => { cfg.TimestampFormat = "[yyyy-MM-dd HH:mm:ss]"; });
});</span>
}

//...
}
}

用法 2, appsettings.json 中配置 Format:

{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
},
<span style="color: #ff0000;">"Console": {
"TimestampFormat": "[yyyy-MM-dd HH:mm:ss]"
}</span>
}
//...
}
ClustrMaps