-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #257 from hrntsm/feature/support-convert-log
Feature/support convert log
- Loading branch information
Showing
8 changed files
with
609 additions
and
279 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
using System; | ||
using System.IO; | ||
using System.Text; | ||
|
||
namespace HoaryFox.Component.Utils | ||
{ | ||
public class ConvertLogger | ||
{ | ||
private readonly StringBuilder _logger = new StringBuilder(); | ||
private readonly string _path; | ||
|
||
public ConvertLogger(string path, string version) | ||
{ | ||
_path = path; | ||
_logger.AppendLine(@"--------------------------------------"); | ||
_logger.AppendLine(@" ____ ____ ________"); | ||
_logger.AppendLine(@"|_ || _| |_ __ |"); | ||
_logger.AppendLine(@" | |__| | .--. ,--. _ .--. _ __ | |_ \_| .--. _ __"); | ||
_logger.AppendLine(@" | __ | / .'`\ \ `'_\ : [ `/'`\] [ \ [ ] | _| / .'`\ \ [ \ [ ]"); | ||
_logger.AppendLine(@" _| | | |_ | \__. | // | |, | | \ '/ / _| |_ | \__. | > ' <"); | ||
_logger.AppendLine(@"|____||____| '.__.' \'-;__/ [___] [\_: / |_____| '.__.' [__]`\_]"); | ||
_logger.AppendLine(@" \__.'"); | ||
_logger.AppendLine($" version:{version}"); | ||
_logger.AppendLine(@" ST-Bridge to Brep Convert Log"); | ||
_logger.AppendLine(@"--------------------------------------"); | ||
_logger.AppendLine($"::INFO :: 変換開始 | {DateTime.Now}"); | ||
} | ||
|
||
public void Clear() | ||
{ | ||
_logger.Clear(); | ||
} | ||
|
||
public void AppendInfoMessage(string message) | ||
{ | ||
_logger.AppendLine($"::INFO :: {message}"); | ||
} | ||
|
||
public void AppendInfoConvertStartMessage(string message) | ||
{ | ||
_logger.AppendLine("--------------------------------------"); | ||
_logger.AppendLine($"::INFO :: {message}の変換を開始しました。 | {DateTime.Now}"); | ||
} | ||
|
||
public void AppendInfoConvertEndMessage(string message) | ||
{ | ||
_logger.AppendLine($"::INFO :: {message}の変換を終了しました。 | {DateTime.Now}"); | ||
_logger.AppendLine("--------------------------------------"); | ||
} | ||
|
||
public void AppendInfoDataNotFoundMessage(string message) | ||
{ | ||
_logger.AppendLine($"::INFO :: {message}のデータはありませんでした。 | {DateTime.Now}"); | ||
_logger.AppendLine("--------------------------------------"); | ||
} | ||
|
||
public void AppendInfo(string guid, string message) | ||
{ | ||
_logger.AppendLine($"::INFO :: [{guid}] | {message}"); | ||
} | ||
|
||
public void AppendConvertSuccess(string guid, string tag) | ||
{ | ||
_logger.AppendLine($"::INFO :: [{guid}] | {tag} | 変換完了"); | ||
} | ||
|
||
public void AppendWarning(string guid, string message) | ||
{ | ||
_logger.AppendLine($"::WARNING:: [{guid}] | {message}"); | ||
} | ||
|
||
public void AppendConvertWarning(string guid, string tag, string message) | ||
{ | ||
_logger.AppendLine($"::WARNING:: [{guid}] | {tag} | 変換結果 要確認 | {message}"); | ||
} | ||
|
||
public void AppendError(string guid, string message) | ||
{ | ||
_logger.AppendLine($"::ERROR :: [{guid}] | {message}"); | ||
} | ||
|
||
public void AppendConvertFailed(string guid, string tag, string message) | ||
{ | ||
_logger.AppendLine($"::ERROR :: [{guid}] | {tag} | 変換失敗 | {message}"); | ||
} | ||
|
||
public void AppendSummary(int[] resultCount) | ||
{ | ||
_logger.AppendLine($"::INFO :: [SUMMARY] | {resultCount[0]} 件の変換に成功しました。"); | ||
_logger.AppendLine($"::INFO :: [SUMMARY] | {resultCount[1]} 件が変換出来ましたが、結果の確認が必要です。"); | ||
_logger.AppendLine($"::INFO :: [SUMMARY] | {resultCount[2]} 件の変換に失敗しました。"); | ||
} | ||
|
||
public void Serialize() | ||
{ | ||
AppendInfoConvertEndMessage("ST-BridgeデータのBrepへ"); | ||
File.WriteAllText(_path + "/S2B_convert.log", _logger.ToString()); | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
return _logger.ToString(); | ||
} | ||
} | ||
} |
Oops, something went wrong.