修改日志输出相关

This commit is contained in:
Genteure 2018-03-29 13:02:43 +08:00
parent 5545e6f66d
commit 1831bc67b1
6 changed files with 19 additions and 7 deletions

1
.gitignore vendored
View File

@ -261,3 +261,4 @@ __pycache__/
*.pyc
BililiveRecorder.WPF/BuildInfo.cs
BililiveRecorder.WPF/Nlog.config

View File

@ -151,8 +151,15 @@ namespace BililiveRecorder.Core
}
else
{
// response.StatusCode == HttpStatusCode.OK
Processor = new FlvStreamProcessor(_settings.Feature != EnabledFeature.ClipOnly ? RecordInfo.GetStreamFilePath() : null, _settings.Feature == EnabledFeature.RecordOnly);
string savepath = _settings.Feature != EnabledFeature.ClipOnly ? RecordInfo.GetStreamFilePath() : null;
logger.Log(RealRoomid, LogLevel.Info, "开始下载直播流" + savepath != null ? " 并保存到 " + Path.GetFileName(savepath) : "");
if (triggerType == TriggerType.HttpApiRecheck)
{
triggerType = TriggerType.HttpApi;
}
Processor = new FlvStreamProcessor(savepath, _settings.Feature == EnabledFeature.RecordOnly);
Processor.TagProcessed += Processor_TagProcessed;
Processor.StreamFinalized += Processor_StreamFinalized;
Processor.GetFileName = RecordInfo.GetStreamFilePath;

View File

@ -283,7 +283,7 @@ namespace BililiveRecorder.FlvProcessor
{
lock (_writelock)
{
logger.Info("剪辑处理中,将会保存过去 {0} 秒和将来 {1} 秒的直播", (Tags[Tags.Count - 1].TimeStamp - Tags[0].TimeStamp) / 1000d, Clip_Future);
logger.Info("剪辑处理中,将会保存过去 {0} 秒和将来 {1} 秒的直播", (Tags[Tags.Count - 1].TimeStamp - Tags[0].TimeStamp) / 1000d, Clip_Future);
return new FlvClipProcessor(Metadata, HTags, new List<FlvTag>(Tags.ToArray()), Clip_Future);
}
}

View File

@ -164,7 +164,10 @@
<Content Include="NLog.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Nlog.Release.config" />
<None Include="Nlog.Release.config" />
<None Include="NLog.Debug.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="NLog.xsd">
<SubType>Designer</SubType>
</None>
@ -1223,6 +1226,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>cd $(SolutionDir)
PowerShell -ExecutionPolicy Bypass -File .\CI\patch_buildinfo.ps1</PreBuildEvent>
PowerShell -ExecutionPolicy Bypass -File .\CI\patch_buildinfo.ps1
copy /y .\BililiveRecorder.WPF\Nlog.$(ConfigurationName).config .\BililiveRecorder.WPF\NLog.config</PreBuildEvent>
</PropertyGroup>
</Project>

View File

@ -17,7 +17,7 @@
-->
<targets>
<target name="WPFLogger" xsi:type="MethodCall" className="BililiveRecorder.WPF.MainWindow, BililiveRecorder.WPF" methodName="AddLog">
<parameter layout="[${date:format=HH\:mm\:ss}] ${uppercase:${level}} ${message} ${exception:format=ToString,StackTrace}" />
<parameter layout="[${date:format=HH\:mm\:ss}] ${uppercase:${level}} ${event-properties:item=roomid} ${message} ${exception:format=ToString,StackTrace}" />
</target>
<!--
add your targets here

View File

@ -7,7 +7,7 @@
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
<targets>
<target name="WPFLogger" xsi:type="MethodCall" className="BililiveRecorder.WPF.MainWindow, BililiveRecorder.WPF" methodName="AddLog">
<parameter layout="[${date:format=HH\:mm\:ss}] ${uppercase:${level}} ${message} ${exception:format=ToString,StackTrace}" />
<parameter layout="[${date:format=HH\:mm\:ss}] ${uppercase:${level}} ${event-properties:item=roomid} ${message} ${exception:format=ToString,StackTrace}" />
</target>
</targets>
<rules>