Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- setInterval 정지
- mosquitto.conf
- 1883
- mySQL_Replication
- map이 undefined가 뜰 때
- pm2
- datagridview 직접입력
- pm2 시작
- setInterval 중지
- allow_anonymouse
- pm2 설치
- DataGridView 직접 입력
- invalid data
- listener 1883
- mosquitto
- html #select #option #multiple
- 맥 어드레스
- 데이터테이블 데이터 넣기
- pm2 상태 확인
- 서버동기화
- DatePicker
- 공인IP
- timepicker
- c# datagridview 데이터 넣기
- AntDesign
- Replication
- setInterval 외부 정지
- pm2 확인
- setInterval clear
- transfer
Archives
- Today
- Total
개발 노트
로그파일저장 본문
MQTT 로그에서 TOPIC과 PAYLOAD를 저장
함수로 TOPIC인자와 PAYLOAD인자받기
private void logSave2(string topic, string payload)
{
string currentPath = System.IO.Directory.GetCurrentDirectory();
string[] lines = {DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff - ") + topic + " - " + payload};
using (StreamWriter Write = new StreamWriter(@"" + currentPath + "\\Log\\" + "log-MQTT-" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt",true))
{
foreach (string line in lines)
{
Write.WriteLine(line);
}
}
using System.IO;
string Path = @"경로\Write.txt";
string[] lines = {"첫번째 줄", "두번째 줄", "세번째줄"};
using (StreamWriter Write = new StreamWriter(path))
{
foreach (string line in lines)
{
Write.WriteLine(line);
}
}
using (StreamWriter Write = new StreamWriter(path, true))
{
foreach (string line in lines)
{
Write.WriteLine(line);
}
}
'프로그래밍 > C#' 카테고리의 다른 글
SERIALIZE DESERIALIZE (0) | 2022.03.14 |
---|---|
System.IO 파일입출력 텍스트모드 바이너리모드 (0) | 2022.03.10 |
C# listbox 텍스트파일 저장후 불러오기 (0) | 2022.03.07 |
C# 현재경로로 파일 저장하기 (0) | 2022.03.07 |
C# ini 저장해서 재실행시 불러오기 (0) | 2022.03.07 |