diff --git a/server/controllers/controllerTown.js b/server/controllers/controllerTown.js index f06a31e45..9f36da885 100644 --- a/server/controllers/controllerTown.js +++ b/server/controllers/controllerTown.js @@ -175,7 +175,7 @@ function ControllerTown() { return cb(err); } req[item.name] = data; - log.info('T DATA[' + item.name + '] sID=', req.sessionID); + log.debug('T DATA[' + item.name + '] sID=', req.sessionID); log.silly('T DATA[' + item.name + '] : ', req[item.name]); cb(null); }); @@ -186,7 +186,7 @@ function ControllerTown() { return cb(err); } req[item.name] = data; - log.info('T DATA[' + item.name + '] sID=', req.sessionID); + log.debug('T DATA[' + item.name + '] sID=', req.sessionID); log.silly('T DATA[' + item.name + '] : ', req[item.name]); cb(null); }); @@ -238,7 +238,7 @@ function ControllerTown() { return cb(err); } req[item.name] = midData; - log.info('M DATA[' + item.name + '] sID=',req.sessionID); + log.debug('M DATA[' + item.name + '] sID=',req.sessionID); log.silly('M DATA[' + item.name + '] : ', req[item.name]); cb(null); }); @@ -258,7 +258,7 @@ function ControllerTown() { if(err){ log.error(new Error('Gad> something is wrong to get weather data : ' + err.message)); } - log.info('>sID=',req.sessionID, 'go next'); + log.debug('>sID=',req.sessionID, 'go next'); next(); } ); @@ -280,9 +280,9 @@ function ControllerTown() { var req = require('request'); var url = "http://"+config.ipAddress+":"+config.port+"/gather/"; - log.info('Start url='+url+apiName); + log.debug('Start url='+url+apiName); req(url+apiName, {json: true}, function(err, response, body) { - log.info('Finished '+apiName+' '+new Date()); + log.debug('Finished '+apiName+' '+new Date()); if (err) { log.error(err); return callback(); @@ -377,7 +377,7 @@ function ControllerTown() { meta.region = regionName; meta.city = cityName; meta.town = townName; - log.info('>sID=',req.sessionID, meta); + log.debug('> sID=',req.sessionID, meta); try{ /* @@ -438,7 +438,7 @@ function ControllerTown() { meta.region = regionName; meta.city = cityName; meta.town = townName; - log.info('>sID=',req.sessionID, meta); + log.debug('> sID=',req.sessionID, meta); self._getCoord(regionName, cityName, townName, function(err, coord) { if(err) { @@ -446,6 +446,7 @@ function ControllerTown() { return next(); } + // req.short 데이터가 없을 경우 만들어준다. if(!req.hasOwnProperty('short')) { req.short = self._makeBasicShortList(); @@ -480,10 +481,10 @@ function ControllerTown() { break; } } - + //동일한 경우뿐만 아니라 동일한 경우 없이 바로 적은 경우에도 해당하는 인덱스 다음부터 사용해야 함. i = i+1; - + var j; var found; var overwrite = false; @@ -575,7 +576,7 @@ function ControllerTown() { meta.region = regionName; meta.city = cityName; meta.town = townName; - log.info('>sID=',req.sessionID, meta); + log.debug('> sID=',req.sessionID, meta); try{ self._getCoord(regionName, cityName, townName, function(err, coord){ @@ -636,7 +637,7 @@ function ControllerTown() { meta.region = regionName; meta.city = cityName; meta.town = townName; - log.info('>sID=',req.sessionID, meta); + log.debug('> sID=',req.sessionID, meta); try{ self._getCoord(regionName, cityName, townName, function(err, coord) { @@ -993,7 +994,7 @@ function ControllerTown() { var weatherType = stnWeatherInfo.weatherType; if (stnWeatherInfo.rnsSource) { - log.info('CheckWeather : rns set by '+stnWeatherInfo.rnsSource); + log.debug('CheckWeather : rns set by '+stnWeatherInfo.rnsSource); } if (weather !== undefined) { @@ -1155,7 +1156,7 @@ function ControllerTown() { meta.region = regionName; meta.city = cityName; meta.town = townName; - log.info('>sID=',req.sessionID, meta); + log.debug('> sID=',req.sessionID, meta); self._getTownInfo(req.params.region, req.params.city, req.params.town, function (err, townInfo) { controllerKmaStnWeather.getCityHourlyList(townInfo, function (err, stnWeatherInfo) { @@ -1233,7 +1234,7 @@ function ControllerTown() { meta.region = regionName; meta.city = cityName; meta.town = townName; - log.info('>sID=',req.sessionID, meta); + log.debug('> sID=',req.sessionID, meta); var currentTime = self._getCurrentTimeValue(9); @@ -1429,7 +1430,7 @@ function ControllerTown() { meta.region = regionName; meta.city = cityName; meta.town = townName; - log.info('>sID=',req.sessionID, meta); + log.debug('> sID=',req.sessionID, meta); var currentTime = self._getCurrentTimeValue(9); @@ -1483,7 +1484,7 @@ function ControllerTown() { meta.region = req.params.region; meta.city = req.params.city; meta.town = req.params.town; - log.info('>sID=',req.sessionID, meta); + log.debug('> sID=',req.sessionID, meta); if (!req.current) { req.current={}; @@ -1505,7 +1506,7 @@ function ControllerTown() { var date = kmaTimeLib.convertDateToYYYYMMDD(now); var time = kmaTimeLib.convertDateToHHZZ(now); - log.info(date+time, meta); + log.debug(date+time, meta); controllerKmaStnWeather.getStnHourly(townInfo, date+time, req.current.t1h, function (err, stnWeatherInfo) { if (err) { log.error(err); @@ -1518,11 +1519,11 @@ function ControllerTown() { var currentTime = kmaTimeLib.convertStringToDate(req.current.date+req.current.time); if (currentTime.getTime() >= stnWeatherInfoTime.getTime()) { - log.info('use api first, just append new data of stn hourly weather info'); + log.debug('use api first, just append new data of stn hourly weather info'); stnHourlyFirst = false; } else { - log.info('overwrite all data'); + log.debug('getKmaStnHourlyWeather > overwrite all data'); } //체크 가능한 값이 아래 3가지뿐임. t1h는 실제로 0도일 수 있지만, 에러인 경우에도 0으로 옴. @@ -1610,7 +1611,7 @@ function ControllerTown() { meta.region = req.params.region; meta.city = req.params.city; meta.town = req.params.town; - log.info('>sID=',req.sessionID, meta); + log.debug('In > sID=',req.sessionID, meta); if (!req.current) { req.current={}; @@ -1631,11 +1632,11 @@ function ControllerTown() { var date = kmaTimeLib.convertDateToYYYYMMDD(now); var time = kmaTimeLib.convertDateToHHMM(now); - log.info('>sID=', req.sessionID, 'dateTime:', date+time); + log.debug('> sID=', req.sessionID, 'dateTime:', date+time); var reqCurrent = req.current; - log.info('>sID=', req.sessionID, 'req.current:', JSON.stringify(reqCurrent)); + log.debug('> sID=', req.sessionID, 'req.current:', JSON.stringify(reqCurrent)); controllerKmaStnWeather.getStnHourlyAndMinRns(townInfo, date+time, reqCurrent, function (err, stnWeatherInfo) { if (err) { @@ -1651,7 +1652,7 @@ function ControllerTown() { return; } - log.info('>sID=', req.sessionID, 'stnWeatherInfo:', JSON.stringify(stnWeatherInfo)); + log.debug('> sID=', req.sessionID, 'stnWeatherInfo:', JSON.stringify(stnWeatherInfo)); try { var stnWeatherInfoTime = new Date(stnWeatherInfo.stnDateTime); @@ -1661,12 +1662,12 @@ function ControllerTown() { if (currentTime.getTime() >= stnWeatherInfoTime.getTime()) { - log.info('>sID=',req.sessionID, + log.debug('> sID=',req.sessionID, 'use api first, just append new data of stn hourly weather info'); stnFirst = false; } else { - log.debug('>sID=',req.sessionID, 'overwrite all data'); + log.debug('> sID=',req.sessionID, 'overwrite all data'); } } @@ -1716,7 +1717,7 @@ function ControllerTown() { reqCurrent.weather = ControllerWeatherDesc.getWeatherStr(reqCurrent.weatherType, res); self._updateCurrentFromMinWeather(req.currentList, reqCurrent); - log.info('>sID=', req.sessionID, 'reqCurrent:', JSON.stringify(reqCurrent)); + log.debug('> sID=', req.sessionID, 'reqCurrent:', JSON.stringify(reqCurrent)); } catch(err) { log.error(err); @@ -1740,7 +1741,7 @@ function ControllerTown() { meta.method = 'convertMidKorStrToSkyInfo'; meta.region = regionName; meta.city = cityName; - log.info('>sID=',req.sessionID, meta); + log.debug('> sID=',req.sessionID, meta); if (!req.hasOwnProperty('midData')) { log.warn("mid data is undefined", meta); @@ -1832,7 +1833,7 @@ function ControllerTown() { meta.method = 'getMidRss'; meta.region = regionName; meta.city = cityName; - log.info('>sID=',req.sessionID, meta); + log.debug('> sID=',req.sessionID, meta); if (!req.hasOwnProperty('midData')) { req.midData = {}; @@ -1881,7 +1882,7 @@ function ControllerTown() { meta.method = 'getMid'; meta.region = regionName; meta.city = cityName; - log.info('>sID=',req.sessionID, meta); + log.debug('> sID=',req.sessionID, meta); try{ manager.getRegIdByTown(regionName, cityName, function(err, code){ @@ -2103,7 +2104,7 @@ function ControllerTown() { return 0; }); - log.info(JSON.stringify(itemList)); + log.debug('makeSummary> ', JSON.stringify(itemList)); if (itemList.length == 0) { log.error("Fail to make summary"); @@ -2130,7 +2131,7 @@ function ControllerTown() { meta.region = req.params.region; meta.city = req.params.city; meta.town = req.params.town; - log.info('>sID=',req.sessionID, meta); + log.debug('> sID=',req.sessionID, meta); if (!req.current || !req.currentList) { log.warn(new Error("Fail to find current weather or current list "+JSON.stringify(meta))); @@ -2222,7 +2223,7 @@ function ControllerTown() { meta.region = req.params.region; meta.city = req.params.city; meta.town = req.params.town; - log.info('>sID=',req.sessionID, meta); + log.debug('> sID=',req.sessionID, meta); if (!req.short && !req.midData) { var err = new Error("Fail to find short, mid weather"); @@ -2285,7 +2286,7 @@ function ControllerTown() { meta.region = req.params.region; meta.city = req.params.city; meta.town = req.params.town; - log.info('>sID=',req.sessionID, meta); + log.debug('> sID=',req.sessionID, meta); if (!req.current) { req.current={}; @@ -2330,12 +2331,12 @@ function ControllerTown() { meta.town = req.params.town; if (req.query.airForecastSource !== 'airkorea') { - log.info('>sID=',req.sessionID, + log.debug('>sID=',req.sessionID, 'skip get keco dust forecast air forecast source='+req.query.airForecastSource, meta); return next(); } - log.info('>sID=',req.sessionID, meta); + log.debug('>sID=',req.sessionID, meta); if (!req.midData) { var err = new Error("Fail to find midData weather "+JSON.stringify(meta)); @@ -2394,7 +2395,7 @@ function ControllerTown() { meta.region = req.params.region; meta.city = req.params.city; meta.town = req.params.town; - log.info('>sID=',req.sessionID, meta); + log.debug('>sID=',req.sessionID, meta); var townName = { first: req.params.region? req.params.region:'', @@ -2421,7 +2422,7 @@ function ControllerTown() { }, function(cb){ // find areaNo from areaNo DB - log.info('Try to find areaNo from AreaNoDB', townName); + log.debug('Try to find areaNo from AreaNoDB', townName); modelAreaNo.find({town:townName}, function(err, areaList){ if(err || areaList.length === 0){ @@ -2429,22 +2430,22 @@ function ControllerTown() { } var item = areaList[0]; - log.info('AreaNo Item : ', item.geo); + log.debug('AreaNo Item : ', item.geo); townGeocode = item.geo; - log.info('Try to find Health data by AreaNo which comes from AreaNoDB'); + log.debug('Try to find Health data by AreaNo which comes from AreaNoDB'); modelHealthDay.find({areaNo:parseInt(item.areaNo)}).lean().exec(function(err, res) { if(err || res.length === 0){ return cb(null); } - log.info('success_byAreaNoDB'); + log.debug('success_byAreaNoDB'); return cb('success_byAreaNoDB', res); }); }); }, function(cb){ - log.info('Try to find near AreaNo by geocode'); + log.debug('Try to find near AreaNo by geocode'); if(townGeocode.length === 0){ if(req.geocode){ @@ -2454,7 +2455,7 @@ function ControllerTown() { return cb('fail to get AreaNo data', undefined); } } - log.info('center geocode : ', townGeocode); + log.debug('center geocode : ', townGeocode); // There is no areaNo in the DB modelAreaNo.find({geo: {$near:townGeocode, $maxDistance: 0.3}}).limit(3).lean().exec(function (err, areaNoList) { if(err || areaNoList.length == 0){ @@ -2462,16 +2463,16 @@ function ControllerTown() { return cb('fail to get areaNo', undefined); } - log.info('Get AreaNo which is near by townName'); + log.debug('Get AreaNo which is near by townName'); async.mapSeries(areaNoList, function(areaNo, callback){ - log.info('AreaNo : ', areaNo.areaNo); + log.debug('AreaNo : ', areaNo.areaNo); modelHealthDay.find({areaNo:parseInt(areaNo.areaNo)}).lean().exec(function(err, res) { if(err || res.length === 0){ log.warn('Health> cannot fild areaNo near by geocode, goto next : ', townGeocode, areaNo.areaNo); return callback(null); } - log.info('succes HealthDay : ', res.length, areaNo.areaNo); + log.debug('succes HealthDay : ', res.length, areaNo.areaNo); cb('find by near AreaNo', res); return callback('success_byNearbyGeocode'); }); @@ -2554,7 +2555,7 @@ function ControllerTown() { meta.region = regionName; meta.city = cityName; meta.town = townName; - log.info('>sID=',req.sessionID, meta); + log.debug('>sID=',req.sessionID, meta); if (!req.hasOwnProperty('midData')) { req.midData = {}; @@ -2627,7 +2628,7 @@ function ControllerTown() { meta.region = regionName; meta.city = cityName; meta.town = townName; - log.info('>sID=',req.sessionID, meta); + log.debug('>sID=',req.sessionID, meta); if (!req.hasOwnProperty('midData')) { req.midData = {}; @@ -2687,7 +2688,7 @@ function ControllerTown() { meta.region = regionName; meta.city = cityName; meta.town = townName; - log.info('>sID=',req.sessionID, meta); + log.debug('>sID=',req.sessionID, meta); if (!req.hasOwnProperty('short')) { log.error("Short forecast data hasn't attached on req"); @@ -3067,7 +3068,7 @@ function ControllerTown() { meta.region = req.params.region; meta.city = req.params.city; meta.town = req.params.town; - log.info('>sID=',req.sessionID, meta); + log.debug('>sID=',req.sessionID, meta); if(req.midData == undefined || req.midData.dailyData == undefined || !Array.isArray(req.midData.dailyData)) { log.error("daily data is undefined"); @@ -3590,7 +3591,7 @@ ControllerTown.prototype._getTimeTable = function () { return listResult; } - log.info('make time table'); + log.debug('make time table'); listResult.push(JSON.parse(JSON.stringify(dateString))); for(var i=0 ; i<45 ; i++){ if(dateString.time === '2100'){ @@ -3620,7 +3621,7 @@ ControllerTown.prototype._getTimeTable = function () { listResult.push(JSON.parse(JSON.stringify(dateString))); } - log.info(listResult); + log.debug(listResult); return listResult; }; @@ -3639,7 +3640,7 @@ ControllerTown.prototype._getShortFromDB = function(regionName, cityName, townNa var self = this; - log.info('list length : ', listTownData.length); + log.debug('list length : ', listTownData.length); for(var i in listTownData){ var townData = listTownData[i]; @@ -3947,7 +3948,7 @@ ControllerTown.prototype._findTown = function(list, region, city, town, cb) { log.error('towns> fail to save to DB :', JSON.stringify(newTown)); } else { - log.info('towns> save to DB :', JSON.stringify(newTown)); + log.debug('towns> save to DB :', JSON.stringify(newTown)); } }); @@ -4187,7 +4188,7 @@ ControllerTown.prototype._getTownDataFromDB = function(db, indicator, req, cb){ }); } else{ - log.info('~> what???'); + log.error('~> what???'); log.error(JSON.stringify(meta)); cb(new Error(JSON.stringify(meta))); return []; diff --git a/server/controllers/geo.controller.js b/server/controllers/geo.controller.js index 00d168a1e..0412540cc 100644 --- a/server/controllers/geo.controller.js +++ b/server/controllers/geo.controller.js @@ -39,7 +39,7 @@ function GeoController(lat, lon, lang, country) { console.error(err); } else { - console.info('geoctrl cached domain:', domain, ', result:', result); + console.debug('geoctrl cached domain:', domain, ', result:', result); } }); diff --git a/server/controllers/kma/kma.forecast.zone.controller.js b/server/controllers/kma/kma.forecast.zone.controller.js index 37a6c588e..13087c3cb 100644 --- a/server/controllers/kma/kma.forecast.zone.controller.js +++ b/server/controllers/kma/kma.forecast.zone.controller.js @@ -22,7 +22,7 @@ class KmaForecastZoneController { } _request(url) { - log.info({kmaForecastZoneCodeUrl: url}); + log.debug({kmaForecastZoneCodeUrl: url}); return new Promise((resolve, reject) => { let options = {json:true, timeout: 3000}; async.retry(3, diff --git a/server/controllers/kma/kma.town.current.controller.js b/server/controllers/kma/kma.town.current.controller.js index ce7896f08..08ddce85f 100644 --- a/server/controllers/kma/kma.town.current.controller.js +++ b/server/controllers/kma/kma.town.current.controller.js @@ -41,9 +41,8 @@ kmaTownCurrentController.prototype.saveCurrent = function(newData, callback){ modelKmaTownCurrent.update({mCoord: coord, fcsDate: fcsDate}, newItem, {upsert:true}, function(err){ if(err){ - log.error('KMA Town C> Fail to update current item'); - log.error(err); - log.info(JSON.stringify(newItem)); + log.error('KMA Town C> Fail to update current item', err); + // log.info(JSON.stringify(newItem)); return cb(); } @@ -100,12 +99,12 @@ kmaTownCurrentController.prototype.getCurrentFromDB = function(modelCurrent, coo var ret = []; var pubDate = kmaTimelib.getKoreaTimeString(result[result.length-1].pubDate); - log.info('KMA Town C> get Data : ', result.length); + log.debug('KMA Town C> get Data : ', result.length); result.forEach(function(item){ var newItem = {}; var curData = item.currentData; - //log.info(JSON.stringify(item)); + //log.debug(JSON.stringify(item)); commonString.forEach(function(string){ newItem[string] = curData[string]; }); @@ -133,7 +132,7 @@ kmaTownCurrentController.prototype.checkPubDate = function(model, srcList, dateS var pubDate = kmaTimelib.getKoreaDateObj(''+ dateString.date + dateString.time); var errCode = 0; - log.info('KMA Town C> checkPubDate pubDate : ', pubDate.toString()); + log.debug('KMA Town C> checkPubDate pubDate : ', pubDate.toString()); try{ async.mapSeries(srcList, function(src,cb){ @@ -145,7 +144,7 @@ kmaTownCurrentController.prototype.checkPubDate = function(model, srcList, dateS for(var i=0 ; i Already updated : ', src, dateString); + log.debug('KMA Town C> Already updated : ', src, dateString); return cb(null); } } @@ -161,8 +160,8 @@ kmaTownCurrentController.prototype.checkPubDate = function(model, srcList, dateS return true; }); - log.info('KMA Town C> Count of the list for the updating : ', result.length); - log.info(JSON.stringify(result)); + log.debug('KMA Town C> Count of the list for the updating : ', result.length); + log.debug(JSON.stringify(result)); return callback(errCode, result); } diff --git a/server/controllers/kma/kma.town.mid.controller.js b/server/controllers/kma/kma.town.mid.controller.js index 6e7bcf484..37ca9b673 100644 --- a/server/controllers/kma/kma.town.mid.controller.js +++ b/server/controllers/kma/kma.town.mid.controller.js @@ -58,7 +58,7 @@ kmaTownMidController.prototype.saveMid = function(type, newData, overwrite, call db.update({regId: regId}, newItem, {upsert:true}, function(err){ if(err){ log.error('KMA Town M> Fail to update Mid : '+ type + ' ID : ' + regId); - log.info(JSON.stringify(newItem)); + // log.info(JSON.stringify(newItem)); return cb(); } cb(); @@ -67,7 +67,7 @@ kmaTownMidController.prototype.saveMid = function(type, newData, overwrite, call db.update({regId: regId, pubDate: pubDate}, newItem, {upsert:true}, function(err){ if(err){ log.error('KMA Town M> Fail to update Mid'+ type + 'item'); - log.info(JSON.stringify(newItem)); + // log.info(JSON.stringify(newItem)); return cb(); } @@ -79,10 +79,10 @@ kmaTownMidController.prototype.saveMid = function(type, newData, overwrite, call var limitedTime = kmaTimelib.getPast8DaysTime(pubDate); log.debug('KMA Town M> finished to save town.mid : ', type); if(overwrite){ - log.info('KMA Town M> remove all item before pubData: ', pubDate.toString()); + log.debug('KMA Town M> remove all item before pubData: ', pubDate.toString()); db.remove({regId: regId, "fcsDate": {$lt:pubDate}}).exec(); }else{ - log.info('KMA Town M> remove all past 8days items: ', limitedTime.toString()); + log.debug('KMA Town M> remove all past 8days items: ', limitedTime.toString()); db.remove({regId: regId, "fcsDate": {$lte:limitedTime}}).exec(); } @@ -190,7 +190,7 @@ kmaTownMidController.prototype.checkPubDate = function(type, srcList, dateString var pubDate = kmaTimelib.getKoreaDateObj(''+ dateString.date + dateString.time); var errCode = 0; - log.info('KMA Town M> pubDate : ', pubDate.toString(), 'Type : ', type); + log.debug('KMA Town M> pubDate : ', pubDate.toString(), 'Type : ', type); try{ var db = dbType[type]; if(db == undefined){ @@ -212,12 +212,12 @@ kmaTownMidController.prototype.checkPubDate = function(type, srcList, dateString for(var i=0 ; i Already updated : ', src, dateString, src.code); + log.debug('KMA Town M> Already updated : ', src, dateString, src.code); return cb(null); } } - log.info('KMA Town M> Need to update : ', src.code); + log.debug('KMA Town M> Need to update : ', src.code); cb(null, src); }); }, @@ -229,7 +229,7 @@ kmaTownMidController.prototype.checkPubDate = function(type, srcList, dateString return true; }); - log.info('KMA Town M> Count of the list for the updating : ', result.length); + log.debug('KMA Town M> Count of the list for the updating : ', result.length); log.silly('KMA Town M> ', JSON.stringify(result)); return callback(errCode, result); diff --git a/server/controllers/kma/kma.town.short.controller.js b/server/controllers/kma/kma.town.short.controller.js index ea58fb613..e3221f203 100644 --- a/server/controllers/kma/kma.town.short.controller.js +++ b/server/controllers/kma/kma.town.short.controller.js @@ -32,7 +32,7 @@ kmaTownShortController.prototype.saveShort = function(newData, callback){ modelKmaTownShort.update({mCoord: coord, fcsDate: fcsDate}, newItem, {upsert:true}, function(err){ if(err){ log.error('KMA Town S> Fail to update short item'); - log.info(JSON.stringify(newItem)); + // log.info(JSON.stringify(newItem)); return cb(); } @@ -80,7 +80,7 @@ kmaTownShortController.prototype.getShortFromDB = function(modelCurrent, coord, var ret = []; var pubDate = kmaTimelib.getKoreaTimeString(result[result.length-1].pubDate); - log.info('KMA Town S> get Data : ', result.length); + log.debug('KMA Town S> get Data : ', result.length); result.forEach(function(item){ var newItem = {}; var shortData = item.shortData; @@ -95,7 +95,7 @@ kmaTownShortController.prototype.getShortFromDB = function(modelCurrent, coord, ret.push(newItem); }); - log.info('KMA Town S> pubDate : ', pubDate); + log.debug('KMA Town S> pubDate : ', pubDate); callback(errorNo, {pubDate: pubDate, ret:ret}); }); @@ -114,7 +114,7 @@ kmaTownShortController.prototype.checkPubDate = function(model, srcList, dateStr var pubDate = kmaTimelib.getKoreaDateObj(''+ dateString.date + dateString.time); var errCode = 0; - log.info('KMA Town S> pubDate : ', pubDate.toString()); + log.debug('KMA Town S> pubDate : ', pubDate.toString()); try{ async.mapSeries(srcList, function(src,cb){ @@ -129,7 +129,7 @@ kmaTownShortController.prototype.checkPubDate = function(model, srcList, dateStr for(var i=0 ; i Already updated : ', src, dateString); + log.debug('KMA Town S> Already updated : ', src, dateString); return cb(null); } } @@ -145,8 +145,8 @@ kmaTownShortController.prototype.checkPubDate = function(model, srcList, dateStr return true; }); - log.info('KMA Town S> Count of the list for the updating : ', result.length); - log.info('KMA Town S> ', JSON.stringify(result)); + log.debug('KMA Town S> Count of the list for the updating : ', result.length); + log.debug('KMA Town S> ', JSON.stringify(result)); return callback(errCode, result); } diff --git a/server/controllers/kma/kma.town.short.rss.controller.js b/server/controllers/kma/kma.town.short.rss.controller.js index d4d5f195c..3ccde3d9b 100644 --- a/server/controllers/kma/kma.town.short.rss.controller.js +++ b/server/controllers/kma/kma.town.short.rss.controller.js @@ -58,7 +58,7 @@ function TownRss(){ self.receivedCount++; if(self.receivedCount == self.coordDb.length){ - log.info('receive complete! : count=', self.receivedCount); + log.debug('receive complete! : count=', self.receivedCount); } }); @@ -91,7 +91,7 @@ TownRss.prototype.loadList = function(completionCallback){ self.coordDb.push(item); }); - log.info('ShortRSS> coord count : ', self.coordDb.length); + log.debug('ShortRSS> coord count : ', self.coordDb.length); } if(completionCallback) { @@ -236,7 +236,7 @@ TownRss.prototype.convertWeatherString = function(string){ case 'W': return 8; default: - log.info('convert : ', string); + log.warn('convertWeatherString > convert : ', string); return -1; } }; @@ -480,7 +480,7 @@ TownRss.prototype.saveShortRss = function(index, newData, cb){ TownRss.prototype.saveShortRssNewForm = function(index, newData, callback){ var pubDate = kmaTimelib.getKoreaDateObj(newData.pubDate); - log.info('KMA Town S-RSS> pubDate :', pubDate.toString()); + log.debug('KMA Town S-RSS> pubDate :', pubDate.toString()); //log.info('KMA Town S-RSS> db find :', coord); @@ -494,7 +494,7 @@ TownRss.prototype.saveShortRssNewForm = function(index, newData, callback){ modelKmaTownShortRss.update({mCoord: newData.mCoord, fcsDate: fcsDate}, newItem, {upsert:true}, function(err){ if(err){ log.error('KMA Town S-RSS> Fail to update current item'); - log.info(JSON.stringify(newItem)); + // log.info(JSON.stringify(newItem)); return cb(); } @@ -527,7 +527,7 @@ TownRss.prototype.getShortRssFromDB = function(model, coord, req, callback) { modelKmaTownShortRss.find({'mCoord.mx': coord.mx, 'mCoord.my': coord.my}, {_id: 0}).sort({"fcsDate":1}).lean().exec(function(err, result){ if(err){ - log.info('KMA Town S-RSS> Fail to file&get short data from DB'); + log.debug('KMA Town S-RSS> Fail to file&get short data from DB'); log.warn('KMA Town S-RSS> Fail to file&get short data from DB'); return callback(err); } @@ -542,7 +542,7 @@ TownRss.prototype.getShortRssFromDB = function(model, coord, req, callback) { var ret = []; var pubDate = kmaTimelib.getKoreaTimeString(result[result.length-1].pubDate); - log.info('KMA Town S-RSS> get Data : ', result.length); + log.debug('KMA Town S-RSS> get Data : ', result.length); result.forEach(function(item){ var newItem = {}; var shortData = item.shortData; @@ -555,7 +555,7 @@ TownRss.prototype.getShortRssFromDB = function(model, coord, req, callback) { ret.push(newItem); }); - log.info('KMA Town S-RSS> result : ', pubDate); + log.debug('KMA Town S-RSS> result : ', pubDate); callback(errorNo, {pubDate: pubDate, ret:ret}); }catch(e){ if (callback) { @@ -681,14 +681,14 @@ TownRss.prototype.checkPubDate = function(item, dateString, index, callback){ if(err || (dbList.length === 0) || (dbList[0].pubDate === undefined)){ - log.info('KMA Town S-RSS> There is no data matached to : ', item); - log.info('shortRss : get new data : ' + index + ', (' + item.mCoord.mx + ',' + item.mCoord.my + ')'); + log.debug('KMA Town S-RSS> There is no data matached to : ', item); + log.debug('shortRss : get new data : ' + index + ', (' + item.mCoord.mx + ',' + item.mCoord.my + ')'); return callback(errCode); } for(var i=0 ; i Already updated : ', item, dateString); + log.debug('KMA Town S-RSS> Already updated : ', item, dateString); errCode = 1; return callback(errCode); } diff --git a/server/controllers/kma/kma.town.shortest.controller.js b/server/controllers/kma/kma.town.shortest.controller.js index a8819d5ec..2ac2c07d5 100644 --- a/server/controllers/kma/kma.town.shortest.controller.js +++ b/server/controllers/kma/kma.town.shortest.controller.js @@ -79,7 +79,7 @@ kmaTownShortestController.prototype.getShortestFromDB = function(modelCurrent, c var ret = []; var pubDate = kmaTimelib.getKoreaTimeString(result[result.length-1].pubDate); - log.info('KMA Town ST> get Data : ', result.length); + log.debug('KMA Town ST> get Data : ', result.length); result.forEach(function(item){ var newItem = {}; var shortestData = item.shortestData; @@ -113,7 +113,7 @@ kmaTownShortestController.prototype.checkPubDate = function(model, srcList, date var pubDate = kmaTimelib.getKoreaDateObj(''+ dateString.date + dateString.time); var errCode = 0; - log.info('KMA Town ST> pubDate : ', pubDate.toString()); + log.debug('KMA Town ST> pubDate : ', pubDate.toString()); try{ async.mapSeries(srcList, function(src,cb){ @@ -128,7 +128,7 @@ kmaTownShortestController.prototype.checkPubDate = function(model, srcList, date for(var i=0 ; i Already updated : ', src, dateString); + log.debug('KMA Town ST> Already updated : ', src, dateString); return cb(null); } } @@ -144,8 +144,8 @@ kmaTownShortestController.prototype.checkPubDate = function(model, srcList, date return true; }); - log.info('KMA Town ST> Count of the list for the updating : ', result.length); - log.info('KMA Town ST> ', JSON.stringify(result)); + log.debug('KMA Town ST> Count of the list for the updating : ', result.length); + log.debug('KMA Town ST> ', JSON.stringify(result)); return callback(errCode, result); } diff --git a/server/controllers/timezone.controller.js b/server/controllers/timezone.controller.js index 5d10f45fb..5489eb2fd 100644 --- a/server/controllers/timezone.controller.js +++ b/server/controllers/timezone.controller.js @@ -60,11 +60,11 @@ class TimezoneController{ this._getTimezoneOffsetFromDB(this.timezone, (err, timezoneOffset)=>{ if(err){ - log.info(this.timezone); + log.debug('TZ > Need to request timeoffset : ', this.timezone); return cb(null, this.timezone); } - log.info('TZ > TimezoneOffset from DB:', timezoneOffset); + log.debug('TZ > TimezoneOffset from DB:', timezoneOffset); return cb('FOUND_TIMEOFFSET', timezoneOffset); }); }, @@ -165,7 +165,7 @@ class TimezoneController{ modelTimezone.find({timezone:timezone}, {_id:0}).limit(1).lean().exec((err, result)=>{ if(err || result.length === 0){ - log.info('TZ > there is no timezone in DB :', err); + log.debug('TZ > there is no timezone in DB :', err); return callback('NO_DATA_IN_DB'); } @@ -207,7 +207,7 @@ class TimezoneController{ _getTimezoneList(callback){ modelTimezone.find().lean().exec((err, list)=>{ if(err || list.length == 0){ - log.info('TZ > There is no timezone info to DB'); + log.debug('TZ > There is no timezone info to DB : ', err); return callback('NO_DATA_IN_DB'); } return callback(undefined, list); @@ -228,7 +228,7 @@ class TimezoneController{ }; this.updatedAt = newItem.updatedAt; - log.info('updateTimezone :', JSON.stringify(newItem)); + log.debug('updateTimezone :', JSON.stringify(newItem)); modelTimezone.update({timezone: newItem.timezone}, newItem, {upsert : true}, @@ -264,7 +264,7 @@ class TimezoneController{ _getGeoByTimezone(timezone, callback){ let encodedUrl = 'https://maps.googleapis.com/maps/api/geocode/json?address='+timezone+'&language=en&key=' + this._googleKey; encodedUrl = encodeURI(encodedUrl); - log.info(encodedUrl); + log.debug(encodedUrl); request.get(encodedUrl, {json:true, timeout: 1000 * 10}, (err, response, body)=>{ if(err) { @@ -295,7 +295,7 @@ class TimezoneController{ } } - log.info('converted geocode : ', JSON.stringify(geocode)); + log.debug('converted geocode : ', JSON.stringify(geocode)); return callback(null, this.geo = geocode); } @@ -321,21 +321,21 @@ class TimezoneController{ encodedUrl += '×tamp=' + Math.floor((new Date().getTime())/1000); encodedUrl += '&key=' + this._googleKey; encodedUrl = encodeURI(encodedUrl); - log.info('TZ > URL for TimezoneOffset :', encodedUrl); + log.debug('TZ > URL for TimezoneOffset :', encodedUrl); request.get(encodedUrl, {json:true, timeout: 1000 * 10}, (err, response, body)=>{ if(err) { - log.error('TZ > Fail!! _getTimozoneOffsetByGeo : ', err); + log.error('TZ > Fail!! _getTimozoneOffsetByGeo : ', err, geo); return callback(err); } if(response.statusCode >= 400){ - err = new Error("response.statusCode="+statusCode); + err = new Error("response.statusCode="+statusCode, geo); return callback(err); } try { - log.info(body); + log.debug(body); if(body.status != 'OK') { log.warn('Cannot get timezone from Google : ', geo); diff --git a/server/controllers/worldWeather/controllerAqi.js b/server/controllers/worldWeather/controllerAqi.js index d3ad972a4..c6f987ecf 100644 --- a/server/controllers/worldWeather/controllerAqi.js +++ b/server/controllers/worldWeather/controllerAqi.js @@ -80,14 +80,14 @@ controllerAqi.prototype._getLocalLast0H = function (timeOffset) { var diffDate = this._getDiffDate(utcTime, localTime); if (diffDate == 0) { - log.info('C Aqi> same day'); + log.debug('C Aqi> same day'); } else if (diffDate == 1) { - log.info('C Aqi> next day'); + log.debug('C Aqi> next day'); utcTime.setUTCDate(utcTime.getUTCDate()+1); } else if (diffDate == -1) { - log.info('C Aqi> previous day'); + log.debug('C Aqi> previous day'); utcTime.setUTCDate(utcTime.getUTCDate()-1); } utcTime.setUTCHours(0); @@ -118,7 +118,7 @@ controllerAqi.prototype.removeAqiDb = function(geocode, callback) { log.error('Aqi DB> fail to get db data', err); return callback(err); } - log.info('Aqi DB > remove data from:'+twoDaysAgo); + log.debug('Aqi DB > remove data from:'+twoDaysAgo); callback(undefined); }); }; @@ -204,7 +204,7 @@ controllerAqi.prototype._saveAQI = function(geocode, date, data, callback){ log.error('AQI> Invalid AQI Data: ', JSON.stringify(newData)); } - log.info('AQI> New Data : ', newData); + log.debug('AQI> New Data : ', newData); res = { geo: [], address: {}, @@ -233,7 +233,7 @@ controllerAqi.prototype._saveAQI = function(geocode, date, data, callback){ res.geo.push(parseFloat(geocode.lon)); res.geo.push(parseFloat(geocode.lat)); - log.info('Aqi> res : ', res); + log.debug('Aqi> res : ', res); query = {geo: res.geo, mTime: res.mTime}; } @@ -333,7 +333,7 @@ controllerAqi.prototype.requestAqiDataFromFeed = function(geocode, idx, timeOffs function (result, callback) { var curTime = new Date(); var date = parseInt(curTime.getTime() / 1000); - log.info('Req AqiFromFeed > cur : ', date.toString()); + log.debug('Req AqiFromFeed > cur : ', date.toString()); self._saveAQI(geocode, date, result, function(err, savedData) { return callback(null, savedData); }); @@ -406,7 +406,7 @@ controllerAqi.prototype.requestAqiData = function(geocode, From, To, timeOffset, date = undefined; } else { - log.info('date : ', (new Date(date*1000)).toISOString()); + log.debug('date : ', (new Date(date*1000)).toISOString()); } requester.getAqiData(geocode, key, function(err, result){ @@ -420,7 +420,7 @@ controllerAqi.prototype.requestAqiData = function(geocode, From, To, timeOffset, if(date === undefined){ var curTime = new Date(); date = parseInt(curTime.getTime() / 1000); - log.info('Req Aqi> cur : ', date.toString()); + log.debug('Req Aqi> cur : ', date.toString()); } self._saveAQI(geocode, date, result, function(err, savedData){ diff --git a/server/controllers/worldWeather/controllerKeys.js b/server/controllers/worldWeather/controllerKeys.js index 82e6e83da..7ab8f4c64 100644 --- a/server/controllers/worldWeather/controllerKeys.js +++ b/server/controllers/worldWeather/controllerKeys.js @@ -39,37 +39,37 @@ function ControllerKeys() { keys: [] }; - log.info('loging keys.....'); - log.info('------------------------------------'); + log.debug('loging keys.....'); + log.debug('------------------------------------'); if(keyBox.owm_keys){ keyBox.owm_keys.forEach(function(item){ self.owm_keys.keys.push(item); }); - log.info('OpenWeatherMap : key count(%d)', self.owm_keys.keys.length); + log.debug('OpenWeatherMap : key count(%d)', self.owm_keys.keys.length); } if(keyBox.wu_keys){ keyBox.wu_keys.forEach(function(item){ self.wu_keys.keys.push(item); }); - log.info('WeatherUnloched : key count(%d)', self.wu_keys.keys.length); + log.debug('WeatherUnloched : key count(%d)', self.wu_keys.keys.length); } if(keyBox.dsf_keys){ keyBox.dsf_keys.forEach(function(item){ self.dsf_keys.keys.push(item); }); - log.info('DarkSkyForecast : key count(%d)', self.dsf_keys.keys.length); + log.debug('DarkSkyForecast : key count(%d)', self.dsf_keys.keys.length); } if(keyBox.aqi_keys){ keyBox.aqi_keys.forEach(function(item){ self.aqi_keys.keys.push(item); }); - log.info('AQI : key count(%d)', self.aqi_keys.keys.length); + log.debug('AQI : key count(%d)', self.aqi_keys.keys.length); } - log.info('------------------------------------'); - log.info('Keys have been loaded'); + log.debug('------------------------------------'); + log.debug('Keys have been loaded'); } ControllerKeys.prototype.addKey = function(type, key){ @@ -120,7 +120,7 @@ ControllerKeys.prototype.getOwmKey = function(){ if (self.owm_keys.curIndex >= self.owm_keys.keys.length) { // no more keys. - log.info('OWM key : There is no more available key'); + log.warn('OWM key : There is no more available key'); return ''; } } @@ -147,7 +147,7 @@ ControllerKeys.prototype.getWuKey = function(){ if (self.wu_keys.curIndex >= self.wu_keys.keys.length) { // no more keys. - log.info('WU key : There is no more available key'); + log.warn('WU key : There is no more available key'); return ''; } } @@ -174,7 +174,7 @@ ControllerKeys.prototype.getDsfKey = function(){ if (self.dsf_keys.curIndex >= self.dsf_keys.keys.length) { // no more keys. - log.info('DSF key : There is no more available key'); + log.warn('DSF key : There is no more available key'); return ''; } self.dsf_keys.usedCount = 0; @@ -202,7 +202,7 @@ ControllerKeys.prototype.getAqiKey = function(){ if (self.aqi_keys.curIndex >= self.aqi_keys.keys.length) { // no more keys. - log.info('AQI key : There is no more available key'); + log.warn('AQI key : There is no more available key'); return ''; } self.aqi_keys.usedCount = 0; diff --git a/server/controllers/worldWeather/controllerWorldWeather.js b/server/controllers/worldWeather/controllerWorldWeather.js index cd1a3cb3d..e1ba032fe 100644 --- a/server/controllers/worldWeather/controllerWorldWeather.js +++ b/server/controllers/worldWeather/controllerWorldWeather.js @@ -144,7 +144,7 @@ function controllerWorldWeather() { req.version = req.params.version; - log.info("WW>",meta); + log.debug("WW>",meta); // todo: To check all version and make way to alternate route. if(req.version !== '010000') { @@ -153,7 +153,7 @@ function controllerWorldWeather() { req.error = 'WW> It is not valid version : ' + req.version; next(); }else{ - log.info('WW> go to next step', meta); + log.debug('WW> go to next step', meta); req.validVersion = true; next(); } @@ -345,7 +345,7 @@ function controllerWorldWeather() { }; self._isSameDayString = function(current, target){ - log.info('_isSameDayString', current, target); + log.debug('_isSameDayString', current, target); // YYYY.mm.dd HH:MM if(current.slice(0, 10) === target.slice(0, 10)){ return true; @@ -375,7 +375,7 @@ function controllerWorldWeather() { var fDate = new Date(firstStr); var sDate = new Date(secondStr); - log.info('_compareDate > :', fDate.toString(), sDate.toString()); + log.debug('_compareDate > :', fDate.toString(), sDate.toString()); return fDate.getTime() > sDate.getTime(); }; @@ -418,7 +418,7 @@ function controllerWorldWeather() { * @private */ self._getUntil15Mins = function(current, target){ - log.info('Compare Date', current, target); + log.debug('Compare Date', current, target); var currentDate = new Date(current); var targetDate = new Date(target); var MS_15MINS = 1000*60*16; // 15 mins means is from 15:00:00 ~ 15:59:99 @@ -572,19 +572,19 @@ function controllerWorldWeather() { return; } - log.info('cDate : ', cDate.toString()); - log.info('AQI DB Date : ', req.AQI.dateObj.toString()); + log.debug('cDate : ', cDate.toString()); + log.debug('AQI DB Date : ', req.AQI.dateObj.toString()); //업데이트 시간이 한시간을 넘어가면 어제,오늘,예보 갱신. if (!self.checkValidDate(cDate, req.AQI.dateObj, 60)) { - log.info('TWW> Invaild AQI data', meta); - log.info('TWW> AQI CurDate : ', cDate.toString(), meta); - log.info('TWW> AQI DB Date : ', req.AQI.dateObj.toString(), meta); + log.debug('TWW> Invaild AQI data', meta); + log.debug('TWW> AQI CurDate : ', cDate.toString(), meta); + log.debug('TWW> AQI DB Date : ', req.AQI.dateObj.toString(), meta); callback(null, 'err_exit_notValid'); return; } - log.info('TWW> get AQI data', meta); + log.debug('TWW> get AQI data', meta); callback(null, null); }); }, @@ -712,7 +712,7 @@ function controllerWorldWeather() { return res.status(400).send(errMsg); } - log.info('TWW> geocode : ', req.geocode, meta); + log.debug('TWW> geocode : ', req.geocode, meta); async.parallel([ function(callback) { @@ -1526,22 +1526,22 @@ function controllerWorldWeather() { var dsf = req.DSF; let timeOffset = req.result.timezone.ms; - log.info('cervert DSF LocalTime > root Timeoffset : ', timeOffset); + log.debug('cervert DSF LocalTime > root Timeoffset : ', timeOffset); dsf.data.forEach(function(dsfItem){ if(dsfItem.current){ if(dsfItem.current.timeOffset){ timeOffset = dsfItem.current.timeOffset * 60 * 1000; - log.info('DSF LocalTime > overwrite timeoffset to : ', dsfItem.current.timeOffset); + log.debug('DSF LocalTime > overwrite timeoffset to : ', dsfItem.current.timeOffset); } var time = new Date(); - log.info('convert DSF LocalTime > current Before :', meta, dsfItem.current.dateObj.toString()); + log.debug('convert DSF LocalTime > current Before :', meta, dsfItem.current.dateObj.toString()); time.setTime(new Date(dsfItem.current.dateObj).getTime() + timeOffset); dsfItem.current.dateObj = self._convertTimeString(time); - log.info('convert DSF LocalTime > current After : ', meta, dsfItem.current.dateObj.toString()); + log.debug('convert DSF LocalTime > current After : ', meta, dsfItem.current.dateObj.toString()); } if(dsfItem.hourly){ - log.info('convert DSF LocalTime > hourly', meta); + log.debug('convert DSF LocalTime > hourly', meta); dsfItem.hourly.data.forEach(function(hourlyItem){ var time = new Date(); time.setTime(new Date(hourlyItem.dateObj).getTime() + timeOffset); @@ -1550,7 +1550,7 @@ function controllerWorldWeather() { } if(dsfItem.daily){ - log.info('convert DSF LocalTime > daily', meta); + log.debug('convert DSF LocalTime > daily', meta); dsfItem.daily.data.forEach(function(dailyItem){ var time = new Date(); time.setTime(new Date(dailyItem.dateObj).getTime() + timeOffset); @@ -1650,8 +1650,8 @@ function controllerWorldWeather() { req.result.daily = []; } - log.info('DSF Daily> SDate : ', startDate, meta); - log.info('DSF Daily> CDdate : ', curDate, meta); + log.debug('DSF Daily> SDate : ', startDate, meta); + log.debug('DSF Daily> CDdate : ', curDate, meta); dsf.data.forEach(function(item){ item.daily.data.forEach(function(dbItem){ @@ -1721,9 +1721,9 @@ function controllerWorldWeather() { req.result.thisTime = []; } - log.info('DSF Hourly> SDate : ', startDate, meta); - log.info('DSF Hourly> yesterday : ', yesterdayDate, meta); - log.info('DSF Hourly> CDate : ', curDate, meta); + log.debug('DSF Hourly> SDate : ', startDate, meta); + log.debug('DSF Hourly> yesterday : ', yesterdayDate, meta); + log.debug('DSF Hourly> CDate : ', curDate, meta); //data안의 hourly가 0h~23h 까지이므로, 22,23,0를 묶기위해서 houryList에 모두합침. var hourlyList = []; dsf.data.forEach(function(item) { @@ -1764,7 +1764,7 @@ function controllerWorldWeather() { }); if(!isExist){ - log.info('DSF yesterday > Found yesterday data', dbItem.dateObj, meta); + log.debug('DSF yesterday > Found yesterday data', dbItem.dateObj, meta); req.result.thisTime.push(self._makeCurrentDataFromDSFCurrent(dbItem, res)); } foundYesterday = true; @@ -1800,6 +1800,8 @@ function controllerWorldWeather() { if (!foundYesterday) { log.error("Fail to find yesterday data!", meta); + log.info('==> Hourly Item List : ', JSON.stringify(hourlyList)); + log.info('==> Thistime List : ', JSON.stringify(req.result.thisTime)); var yesterdayObj = {date: yesterdayDate}; req.result.thisTime.push(yesterdayObj); } @@ -1924,8 +1926,8 @@ function controllerWorldWeather() { req.result.thisTime = []; } - log.info('DSF current> SDate : ', startDate, meta); - log.info('DSF current> CDdate : ', curDate, meta); + log.debug('DSF current> SDate : ', startDate, meta); + log.debug('DSF current> CDdate : ', curDate, meta); dsf.data.forEach(function (item, index) { //log.info('index : ', index, ' dateOBj : ', item.current.dateObj); @@ -1935,7 +1937,7 @@ function controllerWorldWeather() { if(thisTime.date != undefined){ if(self._isSameDayString(item.current.dateObj, thisTime.date)){ if(self._compareDate(item.current.dateObj, thisTime.date)) { - log.info('DSF current > update data from : ', thisTime.date, ' --> To :', item.current.dateObj); + log.debug('DSF current > update data from : ', thisTime.date, ' --> To :', item.current.dateObj); var current = self._makeCurrentDataFromDSFCurrent(item.current, res); var isNight = self._isNight(curDate, item.daily.data); current.skyIcon = self._parseWorldSkyState(current.precType, current.cloud, isNight); @@ -1947,7 +1949,7 @@ function controllerWorldWeather() { }); if(!isExist){ - log.info('DSF current > Found current data', item.current.dateObj.toString(), meta); + log.debug('DSF current > Found current data', item.current.dateObj.toString(), meta); var current = self._makeCurrentDataFromDSFCurrent(item.current, res); var isNight = self._isNight(curDate, item.daily.data); current.skyIcon = self._parseWorldSkyState(current.precType, current.cloud, isNight); @@ -1957,6 +1959,7 @@ function controllerWorldWeather() { }); if (req.result.thisTime.length === 0) { log.error('DSF current > Fail to find current data', curDate, meta); + log.info('dsf.data > ', JSON.stringify(dsf.data)); } } @@ -1992,7 +1995,7 @@ function controllerWorldWeather() { var time = new Date(); time.setTime(new Date(aqiItem.dateObj).getTime() + req.result.timezone.ms); aqiItem.date = self._convertTimeString(time); - + if (thisTime.date != undefined && self._compareDate(thisTime.date, aqiItem.mTime, 6)){ @@ -2001,7 +2004,7 @@ function controllerWorldWeather() { thisTime.t = aqiItem.t; thisTime.h = aqiItem.h; thisTime.p = aqiItem.p; - log.info('Aqi Unit : ', req.query.airUnit, 'Date:', thisTime.date, ' | ', aqiItem.mTime); + log.debug('Aqi Unit : ', req.query.airUnit, 'Date:', thisTime.date, ' | ', aqiItem.mTime); var indexList = []; var iaqiCode = ''; @@ -2044,8 +2047,8 @@ function controllerWorldWeather() { gradeList.push(thisTime[code + 'Grade']); }); - log.info('Grade List :', JSON.stringify(gradeList)); - log.info('Index List :', JSON.stringify(indexList)); + log.debug('Grade List :', JSON.stringify(gradeList)); + log.debug('Index List :', JSON.stringify(indexList)); // IAQI if(req.query.airUnit === 'airnow') { @@ -2079,7 +2082,7 @@ function controllerWorldWeather() { }else if(additionalPoint >= 2){ thisTime.aqiValue += 50; } - log.info('additionalPoint : ', additionalPoint); + log.debug('additionalPoint : ', additionalPoint); // get grade as index. thisTime.aqiGrade = aqiConverter.index2Grade(req.query.airUnit, thisTime.aqiValue); thisTime.aqiStr = UnitConverter.airkoreaGrade2str(thisTime.aqiGrade, 'aqi', res); @@ -3211,7 +3214,7 @@ function controllerWorldWeather() { } if(list.length === 0){ - log.warn('gAQI> There is no AQI data for ', geo, meta); + log.warn('gAQI> There is no AQI data of DB for ', geo, meta); callback('No Data'); return; } diff --git a/server/controllers/worldWeather/dsf.controller.js b/server/controllers/worldWeather/dsf.controller.js index aed754d9f..3fc92988d 100644 --- a/server/controllers/worldWeather/dsf.controller.js +++ b/server/controllers/worldWeather/dsf.controller.js @@ -67,14 +67,14 @@ class DsfController { var diffDate = this._getDiffDate(utcTime, localTime); if (diffDate == 0) { - log.info('cDSF > _getLocalLast0H : same day'); + log.debug('cDSF > _getLocalLast0H : same day'); } else if (diffDate == 1) { - log.info('cDSF > _getLocalLast0H : next day'); + log.debug('cDSF > _getLocalLast0H : next day'); utcTime.setUTCDate(utcTime.getUTCDate()+1); } else if (diffDate == -1) { - log.info('cDSF > _getLocalLast0H : previous day'); + log.debug('cDSF > _getLocalLast0H : previous day'); utcTime.setUTCDate(utcTime.getUTCDate()-1); } utcTime.setUTCHours(0); @@ -163,7 +163,7 @@ class DsfController { } if(list.length < 3){ - log.info('cDsf > There are few datas : ', list.length); + log.debug('cDsf > There are less datas : ', list.length); } let ret = {}; @@ -246,7 +246,7 @@ class DsfController { // get timezone if(src.timezone){ result['timezone'] = src.timezone; - log.info('cDSF > parse timezone :', result.timezone); + log.debug('cDSF > parse timezone :', result.timezone); } // get timeoffset @@ -478,9 +478,9 @@ class DsfController { } output.current = curData; - log.info('cDSF > 1. cur Date : ', cDate.toString()); + log.debug('cDSF > 1. cur Date : ', cDate.toString()); output.updatedDate = new Date(curData.data.current.dateObj); - log.info('cDSF > 2. updated cur Date : ', output.updatedDate.toString()); + log.debug('cDSF > 2. updated cur Date : ', output.updatedDate.toString()); curRenewal = true; }catch(e){ log.error('cDsf > wrong data : ', e, JSON.stringify(result)); @@ -495,10 +495,11 @@ class DsfController { (curData, cb)=>{ // 2. check timezone if(timeOffset != 1440){ - log.info('No need to receive timezone'); + log.debug('No need to receive timezone'); return cb(null, curData); } - if(curData.address.country === undefined){ + + if(curData.address === undefined || curData.address.country === undefined){ log.warn('cDSF > There is no timezone string'); if(timeOffset === 1440 && curData.timeOffset === undefined){ return cb('2. No TIMEZONE INFO'); @@ -533,7 +534,7 @@ class DsfController { if(curRenewal){ this._saveData(geo, curData, (err)=>{ if(err){ - log.warn('cDSF > Fail to save current Data to DB, ', err); + log.error('cDSF > Fail to save current Data to DB, ', err); } return cb(null); @@ -636,7 +637,7 @@ class DsfController { } }); - log.info('timeoffset :', timeOffset); + log.debug('timeoffset :', timeOffset); this._requestDatas(geo, res, cDate, timeOffset, (err, result)=>{ if(err){ log.error('cDsf > something wrong to get DSF data ', err); @@ -654,7 +655,7 @@ class DsfController { } req.cDate = result.updatedDate || cDate; - log.info('cDSF > cDate : ', req.cDate.toString()); + log.debug('cDSF > cDate : ', req.cDate.toString()); return callback(err, this._makeOutputFormat(result, req)); } ); diff --git a/server/lib/AQI/aqiRequester.js b/server/lib/AQI/aqiRequester.js index cd6bcb27e..3860ad9dd 100644 --- a/server/lib/AQI/aqiRequester.js +++ b/server/lib/AQI/aqiRequester.js @@ -28,7 +28,7 @@ aqiRequester.prototype.getAqiData = function(geocode, key, callback){ var url = self.base_url + 'geo:' + geocode.lat + ';' + geocode.lon + '/?token=' + key; - log.info('AQI> url : ', url); + log.debug('AQI> url : ', url); self.getData(url, self.aqiRetryCount, function(err, res){ if(err){ @@ -93,7 +93,7 @@ aqiRequester.prototype.getData = function(url, retryCount, callback){ var result; try { result = JSON.parse(body); - log.info(result); + log.debug(result); } catch (err) { return callback(err); diff --git a/server/lib/DSF/dsfRequester.js b/server/lib/DSF/dsfRequester.js index 794f8427a..8c491e0a4 100644 --- a/server/lib/DSF/dsfRequester.js +++ b/server/lib/DSF/dsfRequester.js @@ -29,7 +29,7 @@ dsfRequester.prototype.getForecast = function(geocode, date, key, callback){ url += ',' + date; } - log.info('DFS> get data :', url); + log.debug('DFS> get data :', url); self.getData(url, self.defRetryCount, function(err, res){ if(err){ callback(err, {isSuccess: false}); diff --git a/server/lib/aqi.converter.js b/server/lib/aqi.converter.js index 342514e90..cd26d6629 100644 --- a/server/lib/aqi.converter.js +++ b/server/lib/aqi.converter.js @@ -395,7 +395,7 @@ class AqiConverter { }else{ result = parseFloat(result.toFixed(3)); } - log.info('Extra type: ', type, 'Value :', result, ' index : ', Cp); + log.debug('Extra type: ', type, 'Value :', result, ' index : ', Cp); return result; }