Skip to content

Commit

Permalink
gestion du logger
Browse files Browse the repository at this point in the history
  • Loading branch information
lowzonenose authored and elias75015 committed Mar 15, 2024
1 parent 5654399 commit 86386a0
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 27 deletions.
3 changes: 1 addition & 2 deletions src/Utils/LoggerByDefault.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ var LoggerByDefault = {
getLogger : function (name) {
// Substitute global constants configured at compile time
// cf. webpack.config.js
// FIXME howtodo !? DefineWebpackPlugin ? EnvironmentWebpackPlugin ?
("__PRODUCTION__".match(/true/)) ? Log.disableAll() : Log.enableAll();
(process.env.VERBOSE) ? Log.enableAll() : Log.disableAll();
var logname = name || "default";
return Log.getLogger(logname);
}
Expand Down
54 changes: 29 additions & 25 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ var webpack = require("webpack");

// -- plugins
var BannerWebPackPlugin = webpack.BannerPlugin;
var EnvWebPackPlugin = webpack.EnvironmentPlugin;
var TerserJsWebPackPlugin = require("terser-webpack-plugin");
var JsDocWebPackPlugin = require("jsdoc-webpack-plugin");
var CleanWebpackPlugin = require("clean-webpack-plugin");
Expand Down Expand Up @@ -172,31 +173,34 @@ module.exports = (env, argv) => {
onBuildEnd : [],
safe : true
}),
new ReplaceWebpackPlugin(
[
// {
// partten : /__VERSION__/g,
// /** replacement de la clef __VERSION__ par la version du package */
// replacement : function () {
// return version;
// }
// },
// {
// partten : /__DATE__/g,
// /** replacement de la clef __DATE__ par la date du build */
// replacement : function () {
// return date;
// }
// },
{
partten : /__PRODUCTION__/g,
replacement : function () {
/** replacement de la clef __PRODUCTION__ pour le LOGGER */
return production;
}
}
]
),
new EnvWebPackPlugin({
VERBOSE : development
}),
// new ReplaceWebpackPlugin(
// [
// // {
// // partten : /__VERSION__/g,
// // /** replacement de la clef __VERSION__ par la version du package */
// // replacement : function () {
// // return version;
// // }
// // },
// // {
// // partten : /__DATE__/g,
// // /** replacement de la clef __DATE__ par la date du build */
// // replacement : function () {
// // return date;
// // }
// // },
// {
// partten : /__PRODUCTION__/g,
// replacement : function () {
// /** replacement de la clef __PRODUCTION__ pour le LOGGER */
// return production;
// }
// }
// ]
// ),
// new DefineWebpackPlugin({
// __PRODUCTION__ : JSON.stringify(production)
// }),
Expand Down

0 comments on commit 86386a0

Please sign in to comment.