https://sir.kr/cm_free/1455050
이 프로그램을 구현해볼까 조금씩만들고있습니다.
adb통신을 이용하여 안드로이드 디바이스의 로그를 추출하는 로그캣 기능인데..
뜬금없이 만들어볼까? 생각이 들더니 점심 시간 10분씩 투자해서 만득어보고있네요 ㅎㅎㅎ
nodejs는 초보라... 어떻게 완성될지는...
혹시 모르니 만든것 까지만 공유 ㅎㅎㅎ
server.js
[code]
var express = require('express');
var app = express();
// 메인처리
var index = require('./routes/index.js');
app.use('/', index);
// logcat
var logcat = require('./routes/logcat.js');
app.use('/logcat', logcat);
app.listen(4444);
[/code]
routes/index.js (아직의미없음)
[code]
var express = require('express');
var rt = express.Router();
// 메인처리
rt.get('/', function(req, res){
res.send('<h1>ready</h1>');
});
module.exports = rt;
[/code]
routes/logcat.js
[code]
var express = require('express');
var rt = express.Router();
const logcat = require('adbkit-logcat')
const {spawn} = require('child_process')
const proc = spawn('adb', ['logcat', '-B'])
// 로그메인
rt.get('/', function(req, res){
//res.setHeader('Content-Type', 'application/json');
res.set({'Content-Type': 'application/json'});
reader = logcat.readStream(proc.stdout)
reader.on('entry', entry => {
/*
Priority.UNKNOWN i.e. 0.
Priority.DEFAULT i.e. 1. Not available when reading a stream.
Priority.VERBOSE i.e. 2.
Priority.DEBUG i.e. 3.
Priority.INFO i.e. 4.
Priority.WARN i.e. 5.
Priority.ERROR i.e. 6.
Priority.FATAL i.e. 7.
Priority.SILENT i.e. 8. Not available when reading a stream.
*/
//if(entry.priority === 6) {
//res.send(JSON.stringify(entry));
res.write(JSON.stringify(entry));
//console.log(entry);
//}
})
});
module.exports = rt;
[/code]
남은 작업은 ejs 로 프론트단 잡고 vue로 실시간 출력, 필터기능 작업이남았네요.
최종은 일렉트론으로...ㅎㅎ
꿈은 큰데 언제 완성될지는 모르겠습니다.
댓글 26개
게시글 목록
| 번호 | 제목 |
|---|---|
| 1717252 | |
| 1717247 | |
| 1717243 | |
| 1717237 | |
| 1717225 | |
| 1717214 | |
| 1717208 | |
| 1717203 | |
| 1717189 | |
| 1717183 | |
| 1717177 | |
| 1717172 | |
| 1717163 | |
| 1717162 | |
| 1717156 | |
| 1717154 | |
| 1717153 | |
| 1717141 | |
| 1717140 | |
| 1717138 | |
| 1717113 | |
| 1717111 | |
| 1717105 | |
| 1717099 | |
| 1717085 | |
| 1717076 | |
| 1717072 | |
| 1717065 | |
| 1717062 | |
| 1717050 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기