Skip to content

Commit 7112288

Browse files
author
veeck
committed
Use [weatherprovider.<NAME>] in log messages
1 parent 665b36b commit 7112288

File tree

11 files changed

+73
-73
lines changed

11 files changed

+73
-73
lines changed

modules/default/weather/providers/envcanada.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ WeatherProvider.register("envcanada", {
6060
* Called when the weather provider is started
6161
*/
6262
start () {
63-
Log.info(`[weatherprovider] ${this.providerName} started.`);
63+
Log.info(`[weatherprovider.envcanada] ${this.providerName} started.`);
6464
this.setFetchedLocation(this.config.location);
6565
},
6666

@@ -103,13 +103,13 @@ WeatherProvider.register("envcanada", {
103103
fetchCommon (target) {
104104
const forecastURL = this.getUrl(); // Get the approriate URL for the MSC Datamart Index page
105105

106-
Log.debug(`[weather.envcanada] ${target} Index url: ${forecastURL}`);
106+
Log.debug(`[weatherprovider.envcanada] ${target} Index url: ${forecastURL}`);
107107

108108
this.fetchData(forecastURL, "xml") // Query the Index page URL
109109
.then((indexData) => {
110110
if (!indexData) {
111111
// Did not receive usable new data.
112-
Log.info(`weather.envcanada ${target} - did not receive usable index data`);
112+
Log.info(`[weatherprovider.envcanada] ${target} - did not receive usable index data`);
113113
this.updateAvailable(); // If there were issues, update anyways to reset timer
114114
return;
115115
}
@@ -133,27 +133,27 @@ WeatherProvider.register("envcanada", {
133133
forecastFileURL = forecastURL + forecastFile; // Create full URL to the city's weather data
134134
}
135135

136-
Log.debug(`[weather.envcanada] ${target} Citypage url: ${forecastFileURL}`);
136+
Log.debug(`[weatherprovider.envcanada] ${target} Citypage url: ${forecastFileURL}`);
137137

138138
/*
139139
* If the Citypage filename has not changed since the last Weather refresh, the forecast has not changed and
140140
* and therefore we can skip reading the Citypage URL.
141141
*/
142142

143143
if (target === "Current" && this.lastCityPageCurrent === forecastFileURL) {
144-
Log.debug(`[weather.envcanada] ${target} - Newest Citypage has already been seen - skipping!`);
144+
Log.debug(`[weatherprovider.envcanada] ${target} - Newest Citypage has already been seen - skipping!`);
145145
this.updateAvailable(); // Update anyways to reset refresh timer
146146
return;
147147
}
148148

149149
if (target === "Forecast" && this.lastCityPageForecast === forecastFileURL) {
150-
Log.debug(`[weather.envcanada] ${target} - Newest Citypage has already been seen - skipping!`);
150+
Log.debug(`[weatherprovider.envcanada] ${target} - Newest Citypage has already been seen - skipping!`);
151151
this.updateAvailable(); // Update anyways to reset refresh timer
152152
return;
153153
}
154154

155155
if (target === "Hourly" && this.lastCityPageHourly === forecastFileURL) {
156-
Log.debug(`[weather.envcanada] ${target} - Newest Citypage has already been seen - skipping!`);
156+
Log.debug(`[weatherprovider.envcanada] ${target} - Newest Citypage has already been seen - skipping!`);
157157
this.updateAvailable(); // Update anyways to reset refresh timer
158158
return;
159159
}
@@ -162,15 +162,15 @@ WeatherProvider.register("envcanada", {
162162
.then((cityData) => {
163163
if (!cityData) {
164164
// Did not receive usable new data.
165-
Log.info(`weather.envcanada ${target} - did not receive usable citypage data`);
165+
Log.info(`[weatherprovider.envcanada] ${target} - did not receive usable citypage data`);
166166
return;
167167
}
168168

169169
/*
170170
* With the city's weather data read, parse the resulting XML document for the appropriate weather data
171171
* elements to create a weather object. Next, set Weather modules details from that object.
172172
*/
173-
Log.debug(`[weather.envcanada] ${target} - Citypage has been read and will be processed for updates`);
173+
Log.debug(`[weatherprovider.envcanada] ${target} - Citypage has been read and will be processed for updates`);
174174

175175
if (target === "Current") {
176176
const currentWeather = this.generateWeatherObjectFromCurrentWeather(cityData);
@@ -191,12 +191,12 @@ WeatherProvider.register("envcanada", {
191191
}
192192
})
193193
.catch(function (cityRequest) {
194-
Log.info(`weather.envcanada ${target} - could not load citypage data from: ${forecastFileURL}`);
194+
Log.info(`[weatherprovider.envcanada] ${target} - could not load citypage data from: ${forecastFileURL}`);
195195
})
196196
.finally(() => this.updateAvailable()); // Update no matter what to reset weather refresh timer
197197
})
198198
.catch(function (indexRequest) {
199-
Log.error(`weather.envcanada ${target} - could not load index data ... `, indexRequest);
199+
Log.error(`[weatherprovider.envcanada] ${target} - could not load index data ... `, indexRequest);
200200
this.updateAvailable(); // If there were issues, update anyways to reset timer
201201
});
202202
},

modules/default/weather/providers/openmeteo.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ WeatherProvider.register("openmeteo", {
155155
this.setCurrentWeather(currentWeather);
156156
})
157157
.catch(function (request) {
158-
Log.error("[weatherprovider] Could not load data ... ", request);
158+
Log.error("[weatherprovider.openmeteo] Could not load data ... ", request);
159159
})
160160
.finally(() => this.updateAvailable());
161161
},
@@ -173,7 +173,7 @@ WeatherProvider.register("openmeteo", {
173173
this.setWeatherForecast(dailyForecast);
174174
})
175175
.catch(function (request) {
176-
Log.error("[weatherprovider] Could not load data ... ", request);
176+
Log.error("[weatherprovider.openmeteo] Could not load data ... ", request);
177177
})
178178
.finally(() => this.updateAvailable());
179179
},
@@ -191,7 +191,7 @@ WeatherProvider.register("openmeteo", {
191191
this.setWeatherHourly(hourlyForecast);
192192
})
193193
.catch(function (request) {
194-
Log.error("[weatherprovider] Could not load data ... ", request);
194+
Log.error("[weatherprovider.openmeteo] Could not load data ... ", request);
195195
})
196196
.finally(() => this.updateAvailable());
197197
},
@@ -217,7 +217,7 @@ WeatherProvider.register("openmeteo", {
217217
this.config.maxEntries = Math.max(1, Math.min(this.config.maxEntries, maxEntriesLimit));
218218

219219
if (!this.config.type) {
220-
Log.error("[weatherprovider] type not configured and could not resolve it");
220+
Log.error("[weatherprovider.openmeteo] type not configured and could not resolve it");
221221
}
222222

223223
this.fetchLocation();
@@ -340,7 +340,7 @@ WeatherProvider.register("openmeteo", {
340340
this.fetchedLocationName = `${data.city}, ${data.principalSubdivisionCode}`;
341341
})
342342
.catch((request) => {
343-
Log.error("[weatherprovider] Could not load data ... ", request);
343+
Log.error("[weatherprovider.openmeteo] Could not load data ... ", request);
344344
});
345345
},
346346

modules/default/weather/providers/openweathermap.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ WeatherProvider.register("openweathermap", {
4242
this.setCurrentWeather(currentWeather);
4343
})
4444
.catch(function (request) {
45-
Log.error("[weatherprovider] Could not load data ... ", request);
45+
Log.error("[weatherprovider.openweathermap] Could not load data ... ", request);
4646
})
4747
.finally(() => this.updateAvailable());
4848
},
@@ -64,7 +64,7 @@ WeatherProvider.register("openweathermap", {
6464
this.setFetchedLocation(location);
6565
})
6666
.catch(function (request) {
67-
Log.error("[weatherprovider] Could not load data ... ", request);
67+
Log.error("[weatherprovider.openweathermap] Could not load data ... ", request);
6868
})
6969
.finally(() => this.updateAvailable());
7070
},
@@ -88,7 +88,7 @@ WeatherProvider.register("openweathermap", {
8888
this.setWeatherHourly(weatherData.hours);
8989
})
9090
.catch(function (request) {
91-
Log.error("[weatherprovider] Could not load data ... ", request);
91+
Log.error("[weatherprovider.openweathermap] Could not load data ... ", request);
9292
})
9393
.finally(() => this.updateAvailable());
9494
},

modules/default/weather/providers/pirateweather.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ WeatherProvider.register("pirateweather", {
3434
this.setCurrentWeather(currentWeather);
3535
})
3636
.catch(function (request) {
37-
Log.error("[weatherprovider] Could not load data ... ", request);
37+
Log.error("[weatherprovider.pirateweather] Could not load data ... ", request);
3838
})
3939
.finally(() => this.updateAvailable());
4040
},
@@ -51,7 +51,7 @@ WeatherProvider.register("pirateweather", {
5151
this.setWeatherForecast(forecast);
5252
})
5353
.catch(function (request) {
54-
Log.error("[weatherprovider] Could not load data ... ", request);
54+
Log.error("[weatherprovider.pirateweather] Could not load data ... ", request);
5555
})
5656
.finally(() => this.updateAvailable());
5757
},

modules/default/weather/providers/smhi.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ WeatherProvider.register("smhi", {
2828
this.setFetchedLocation(this.config.location || `(${coordinates.lat},${coordinates.lon})`);
2929
this.setCurrentWeather(weatherObject);
3030
})
31-
.catch((error) => Log.error(`[weatherprovider] Could not load data: ${error.message}`))
31+
.catch((error) => Log.error(`[weatherprovider.smhi] Could not load data: ${error.message}`))
3232
.finally(() => this.updateAvailable());
3333
},
3434

@@ -43,7 +43,7 @@ WeatherProvider.register("smhi", {
4343
this.setFetchedLocation(this.config.location || `(${coordinates.lat},${coordinates.lon})`);
4444
this.setWeatherForecast(weatherObjects);
4545
})
46-
.catch((error) => Log.error(`[weatherprovider] Could not load data: ${error.message}`))
46+
.catch((error) => Log.error(`[weatherprovider.smhi] Could not load data: ${error.message}`))
4747
.finally(() => this.updateAvailable());
4848
},
4949

@@ -58,7 +58,7 @@ WeatherProvider.register("smhi", {
5858
this.setFetchedLocation(this.config.location || `(${coordinates.lat},${coordinates.lon})`);
5959
this.setWeatherHourly(weatherObjects);
6060
})
61-
.catch((error) => Log.error(`[weatherprovider] Could not load data: ${error.message}`))
61+
.catch((error) => Log.error(`[weatherprovider.smhi] Could not load data: ${error.message}`))
6262
.finally(() => this.updateAvailable());
6363
},
6464

@@ -69,7 +69,7 @@ WeatherProvider.register("smhi", {
6969
setConfig (config) {
7070
this.config = config;
7171
if (!config.precipitationValue || ["pmin", "pmean", "pmedian", "pmax"].indexOf(config.precipitationValue) === -1) {
72-
Log.log(`[weatherprovider] invalid or not set: ${config.precipitationValue}`);
72+
Log.log(`[weatherprovider.smhi] invalid or not set: ${config.precipitationValue}`);
7373
config.precipitationValue = this.defaults.precipitationValue;
7474
}
7575
},

modules/default/weather/providers/ukmetoffice.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ WeatherProvider.register("ukmetoffice", {
3939
this.setCurrentWeather(currentWeather);
4040
})
4141
.catch(function (request) {
42-
Log.error("[weatherprovider] Could not load data ... ", request);
42+
Log.error("[weatherprovider.ukmetoffice] Could not load data ... ", request);
4343
})
4444
.finally(() => this.updateAvailable());
4545
},
@@ -63,7 +63,7 @@ WeatherProvider.register("ukmetoffice", {
6363
this.setWeatherForecast(forecast);
6464
})
6565
.catch(function (request) {
66-
Log.error("[weatherprovider] Could not load data ... ", request);
66+
Log.error("[weatherprovider.ukmetoffice] Could not load data ... ", request);
6767
})
6868
.finally(() => this.updateAvailable());
6969
},

modules/default/weather/providers/ukmetofficedatahub.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ WeatherProvider.register("ukmetofficedatahub", {
8686
* Did not receive usable new data.
8787
* Maybe this needs a better check?
8888
*/
89-
Log.error("[weatherprovider] Possibly bad current/hourly data?", data);
89+
Log.error("[weatherprovider.ukmetofficedatahub] Possibly bad current/hourly data?", data);
9090
return;
9191
}
9292

@@ -99,7 +99,7 @@ WeatherProvider.register("ukmetofficedatahub", {
9999
})
100100

101101
// Catch any error(s)
102-
.catch((error) => Log.error(`[weatherprovider] Could not load data: ${error.message}`))
102+
.catch((error) => Log.error(`[weatherprovider.ukmetofficedatahub] Could not load data: ${error.message}`))
103103

104104
// Let the module know there is data available
105105
.finally(() => this.updateAvailable());
@@ -161,7 +161,7 @@ WeatherProvider.register("ukmetofficedatahub", {
161161
* Did not receive usable new data.
162162
* Maybe this needs a better check?
163163
*/
164-
Log.error("[weatherprovider] Possibly bad forecast data?", data);
164+
Log.error("[weatherprovider.ukmetofficedatahub] Possibly bad forecast data?", data);
165165
return;
166166
}
167167

@@ -174,7 +174,7 @@ WeatherProvider.register("ukmetofficedatahub", {
174174
})
175175

176176
// Catch any error(s)
177-
.catch((error) => Log.error(`[weatherprovider] Could not load data: ${error.message}`))
177+
.catch((error) => Log.error(`[weatherprovider.ukmetofficedatahub] Could not load data: ${error.message}`))
178178

179179
// Let the module know there is new data available
180180
.finally(() => this.updateAvailable());

modules/default/weather/providers/weatherbit.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ WeatherProvider.register("weatherbit", {
3636
this.setCurrentWeather(currentWeather);
3737
})
3838
.catch(function (request) {
39-
Log.error("[weatherprovider] Could not load data ... ", request);
39+
Log.error("[weatherprovider.weatherbit] Could not load data ... ", request);
4040
})
4141
.finally(() => this.updateAvailable());
4242
},
@@ -55,7 +55,7 @@ WeatherProvider.register("weatherbit", {
5555
this.fetchedLocationName = `${data.city_name}, ${data.state_code}`;
5656
})
5757
.catch(function (request) {
58-
Log.error("[weatherprovider] Could not load data ... ", request);
58+
Log.error("[weatherprovider.weatherbit] Could not load data ... ", request);
5959
})
6060
.finally(() => this.updateAvailable());
6161
},
@@ -79,7 +79,7 @@ WeatherProvider.register("weatherbit", {
7979
this.config.weatherEndpoint = "/current";
8080
break;
8181
default:
82-
Log.error("[weatherprovider] weatherEndpoint not configured and could not resolve it based on type");
82+
Log.error("[weatherprovider.weatherbit] weatherEndpoint not configured and could not resolve it based on type");
8383
}
8484
}
8585
},

modules/default/weather/providers/weatherflow.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ WeatherProvider.register("weatherflow", {
4141
this.fetchedLocationName = data.location_name;
4242
})
4343
.catch(function (request) {
44-
Log.error("[weatherprovider] Could not load data ... ", request);
44+
Log.error("[weatherprovider.weatherflow] Could not load data ... ", request);
4545
})
4646
.finally(() => this.updateAvailable());
4747
},
@@ -81,7 +81,7 @@ WeatherProvider.register("weatherflow", {
8181
this.fetchedLocationName = data.location_name;
8282
})
8383
.catch(function (request) {
84-
Log.error("[weatherprovider] Could not load data ... ", request);
84+
Log.error("[weatherprovider.weatherflow] Could not load data ... ", request);
8585
})
8686
.finally(() => this.updateAvailable());
8787
},
@@ -112,7 +112,7 @@ WeatherProvider.register("weatherflow", {
112112
this.fetchedLocationName = data.location_name;
113113
})
114114
.catch(function (request) {
115-
Log.error("[weatherprovider] Could not load data ... ", request);
115+
Log.error("[weatherprovider.weatherflow] Could not load data ... ", request);
116116
})
117117
.finally(() => this.updateAvailable());
118118
},

modules/default/weather/providers/weathergov.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ WeatherProvider.register("weathergov", {
4949
// Overwrite the fetchCurrentWeather method.
5050
fetchCurrentWeather () {
5151
if (!this.configURLs) {
52-
Log.info("[weatherprovider] fetchCurrentWeather: fetch wx waiting on config URLs");
52+
Log.info("[weatherprovider.weathergov] fetchCurrentWeather: fetch wx waiting on config URLs");
5353
return;
5454
}
5555
this.fetchData(this.stationObsURL)
@@ -62,15 +62,15 @@ WeatherProvider.register("weathergov", {
6262
this.setCurrentWeather(currentWeather);
6363
})
6464
.catch(function (request) {
65-
Log.error("[weatherprovider] Could not load station obs data ... ", request);
65+
Log.error("[weatherprovider.weathergov] Could not load station obs data ... ", request);
6666
})
6767
.finally(() => this.updateAvailable());
6868
},
6969

7070
// Overwrite the fetchWeatherForecast method.
7171
fetchWeatherForecast () {
7272
if (!this.configURLs) {
73-
Log.info("[weatherprovider] fetchWeatherForecast: fetch wx waiting on config URLs");
73+
Log.info("[weatherprovider.weathergov] fetchWeatherForecast: fetch wx waiting on config URLs");
7474
return;
7575
}
7676
this.fetchData(this.forecastURL)
@@ -83,15 +83,15 @@ WeatherProvider.register("weathergov", {
8383
this.setWeatherForecast(forecast);
8484
})
8585
.catch(function (request) {
86-
Log.error("[weatherprovider] Could not load forecast hourly data ... ", request);
86+
Log.error("[weatherprovider.weathergov] Could not load forecast hourly data ... ", request);
8787
})
8888
.finally(() => this.updateAvailable());
8989
},
9090

9191
// Overwrite the fetchWeatherHourly method.
9292
fetchWeatherHourly () {
9393
if (!this.configURLs) {
94-
Log.info("[weatherprovider] fetchWeatherHourly: fetch wx waiting on config URLs");
94+
Log.info("[weatherprovider.weathergov] fetchWeatherHourly: fetch wx waiting on config URLs");
9595
return;
9696
}
9797
this.fetchData(this.forecastHourlyURL)
@@ -108,7 +108,7 @@ WeatherProvider.register("weathergov", {
108108
this.setWeatherHourly(hourly);
109109
})
110110
.catch(function (request) {
111-
Log.error("[weatherprovider] Could not load data ... ", request);
111+
Log.error("[weatherprovider.weathergov] Could not load data ... ", request);
112112
})
113113
.finally(() => this.updateAvailable());
114114
},
@@ -126,7 +126,7 @@ WeatherProvider.register("weathergov", {
126126
return;
127127
}
128128
this.fetchedLocationName = `${data.properties.relativeLocation.properties.city}, ${data.properties.relativeLocation.properties.state}`;
129-
Log.log(`[weatherprovider] Forecast location is ${this.fetchedLocationName}`);
129+
Log.log(`[weatherprovider.weathergov] Forecast location is ${this.fetchedLocationName}`);
130130
this.forecastURL = `${data.properties.forecast}?units=si`;
131131
this.forecastHourlyURL = `${data.properties.forecastHourly}?units=si`;
132132
this.forecastGridDataURL = data.properties.forecastGridData;
@@ -142,7 +142,7 @@ WeatherProvider.register("weathergov", {
142142
this.stationObsURL = `${obsData.features[0].id}/observations/latest`;
143143
})
144144
.catch((err) => {
145-
Log.error("[weatherprovider] fetchWxGovURLs error: ", err);
145+
Log.error("[weatherprovider.weathergov] fetchWxGovURLs error: ", err);
146146
})
147147
.finally(() => {
148148
// excellent, let's fetch some actual wx data

0 commit comments

Comments
 (0)