Created
August 5, 2014 16:42
-
-
Save masaru-b-cl/c5e6212ce7cdf6553f2f to your computer and use it in GitHub Desktop.
タブ区切りのログを出力する
This file contains hidden or 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
using System; | |
namespace ConsoleApplication1 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var logger = NLog.LogManager.GetCurrentClassLogger(); | |
var text = "改行や" + Environment.NewLine + "タブ文字\tを含む項目"; | |
// 独自項目はタブ文字でJoinする | |
// 改行やタブ文字を含む項目は、自前でクォートする | |
var message = String.Join("\t", new[]{"field1", "field2", "\"" + text + "\""}); | |
logger.Info(message); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment