diff --git a/Jenkinsfile b/Jenkinsfile
index f56a4cd..28eb434 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -8,9 +8,9 @@ pipeline {
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
script {
withEnv(['NEXT_BUILD_NUMBER=743']) {
- // env.versionNumber = VersionNumber(versionNumberString : '4.9.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
- env.versionNumber = VersionNumber(versionNumberString : '4.9.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
- env.versionNumberBeta = VersionNumber(versionNumberString : '4.9.${BUILD_DATE_FORMATTED, "yyMM"}-beta.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
+ // env.versionNumber = VersionNumber(versionNumberString : '5.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
+ env.versionNumber = VersionNumber(versionNumberString : '5.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
+ env.versionNumberBeta = VersionNumber(versionNumberString : '5.0.${BUILD_DATE_FORMATTED, "yyMM"}-beta.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
env.APP_NAME = 'SteamWareLib'
}
}
diff --git a/SteamWare.Logger/Constants.cs b/SteamWare.Logger/Constants.cs
index 22a19c0..b9b4bb8 100644
--- a/SteamWare.Logger/Constants.cs
+++ b/SteamWare.Logger/Constants.cs
@@ -6,14 +6,19 @@ using System.Threading.Tasks;
namespace SteamWare.Logger
{
- public class Constants
- {
- public enum ERROR_LEVEL
+ public class Constants
{
- INFO = 1,
- WARNING = 2,
- ERROR = 3,
- FATAL = 4
+ #region Public Enums
+
+ public enum ERROR_LEVEL
+ {
+ Info = 1,
+ Warning,
+ Error,
+ Exception,
+ Fatal
+ }
+
+ #endregion Public Enums
}
- }
}
\ No newline at end of file
diff --git a/SteamWare.Logger/Logging.cs b/SteamWare.Logger/Logging.cs
index 4ecfae9..166ca9d 100644
--- a/SteamWare.Logger/Logging.cs
+++ b/SteamWare.Logger/Logging.cs
@@ -6,92 +6,112 @@ using static SteamWare.Logger.Constants;
namespace SteamWare.Logger
{
- ///
- /// Classe helper x LOG basata su NLog
- ///
- public static class Logging
- {
///
- /// S
+ /// Classe helper x LOG basata su NLog
///
- public static NLog.Logger Instance { get; private set; }
-
- static Logging()
+ public static class Logging
{
+ #region Private Fields
+
+ private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
+
+ #endregion Private Fields
+
+ #region Public Constructors
+
+ static Logging()
+ {
#if DEBUG
- // Setup the logging view for Sentinel - http://sentinel.codeplex.com
- var sentinalTarget = new NLogViewerTarget()
- {
- Name = "sentinal",
- Address = "udp://127.0.0.1:9999",
- IncludeNLogData = false
- };
- var sentinalRule = new LoggingRule("*", LogLevel.Trace, sentinalTarget);
- LogManager.Configuration.AddTarget("sentinal", sentinalTarget);
- LogManager.Configuration.LoggingRules.Add(sentinalRule);
+ // Setup the logging view for Sentinel - http://sentinel.codeplex.com
+ var sentinalTarget = new NLogViewerTarget()
+ {
+ Name = "sentinal",
+ Address = "udp://127.0.0.1:9999",
+ IncludeNLogData = false
+ };
+ var sentinalRule = new LoggingRule("*", LogLevel.Trace, sentinalTarget);
+ LogManager.Configuration.AddTarget("sentinal", sentinalTarget);
+ LogManager.Configuration.LoggingRules.Add(sentinalRule);
#endif
- LogManager.ReconfigExistingLoggers();
+ LogManager.ReconfigExistingLoggers();
- Instance = LogManager.GetCurrentClassLogger();
- }
+ Instance = LogManager.GetCurrentClassLogger();
+ }
- private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
+ #endregion Public Constructors
- public static void LogException(Exception ex, ERROR_LEVEL errorLevel)
- {
- LogMessage(ex.Message, errorLevel);
- }
- public static void LogMessage(string message, ERROR_LEVEL errorLevel)
- {
- switch (errorLevel)
- {
- case ERROR_LEVEL.INFO:
- {
- Log.Info(message);
- }
- break;
- case ERROR_LEVEL.WARNING:
- {
- Log.Warn(message);
- }
- break;
+ #region Public Properties
- case ERROR_LEVEL.ERROR:
- {
+ ///
+ /// S
+ ///
+ public static NLog.Logger Instance { get; private set; }
+
+ #endregion Public Properties
+
+
+
+ #region Public Methods
+
+ public static void LogError(string message)
+ {
Log.Error(message);
- }
- break;
+ }
- case ERROR_LEVEL.FATAL:
- {
+ public static void LogException(Exception ex, ERROR_LEVEL errorLevel)
+ {
+ LogMessage(ex.Message, errorLevel);
+ }
+
+ public static void LogFatal(string message)
+ {
Log.Fatal(message);
- }
- break;
- }
- }
+ }
- public static void LogInfo(string message)
- {
- Log.Info(message);
- }
+ public static void LogInfo(string message)
+ {
+ Log.Info(message);
+ }
- public static void LogWarning(string message)
- {
- Log.Warn(message);
- }
+ public static void LogMessage(string message, ERROR_LEVEL errorLevel)
+ {
+ switch (errorLevel)
+ {
+ case ERROR_LEVEL.Info:
+ {
+ Log.Info(message);
+ }
+ break;
- public static void LogError(string message)
- {
- Log.Error(message);
- }
+ case ERROR_LEVEL.Warning:
+ {
+ Log.Warn(message);
+ }
+ break;
- public static void LogFatal(string message)
- {
- Log.Fatal(message);
+ case ERROR_LEVEL.Error:
+ {
+ Log.Error(message);
+ }
+ break;
+
+ case ERROR_LEVEL.Fatal:
+ {
+ Log.Fatal(message);
+ }
+ break;
+ }
+ }
+
+ public static void LogWarning(string message)
+ {
+ Log.Warn(message);
+ }
+
+ #endregion Public Methods
}
- }
}
\ No newline at end of file
diff --git a/SteamWareLib/Logging.cs b/SteamWareLib/Logging.cs
deleted file mode 100644
index c8d63be..0000000
--- a/SteamWareLib/Logging.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using NLog;
-using NLog.Config;
-using NLog.Targets;
-
-namespace SteamWare
-{
- ///
- /// Classe helper x LOG basata su NLog
- ///
- public static class Log
- {
- ///
- /// S
- ///
- public static Logger Instance { get; private set; }
- static Log()
- {
-#if DEBUG
- // Setup the logging view for Sentinel - http://sentinel.codeplex.com
- var sentinalTarget = new NLogViewerTarget()
- {
- Name = "sentinal",
- Address = "udp://127.0.0.1:9999",
- IncludeNLogData = false
- };
- var sentinalRule = new LoggingRule("*", LogLevel.Trace, sentinalTarget);
- LogManager.Configuration.AddTarget("sentinal", sentinalTarget);
- LogManager.Configuration.LoggingRules.Add(sentinalRule);
-
-#endif
-
- LogManager.ReconfigExistingLoggers();
-
- Instance = LogManager.GetCurrentClassLogger();
- }
- }
-}
\ No newline at end of file
diff --git a/SteamWareLib/SteamWare.csproj b/SteamWareLib/SteamWare.csproj
index 15b5f99..bc86ee8 100644
--- a/SteamWareLib/SteamWare.csproj
+++ b/SteamWareLib/SteamWare.csproj
@@ -269,7 +269,6 @@
-
@@ -448,6 +447,12 @@
+
+
+ {97a9f482-c173-4f0f-9f8f-7bb41c59cdd6}
+ SteamWare.Logger
+
+
diff --git a/SteamWareLib/memLayer.cs b/SteamWareLib/memLayer.cs
index a3ae1ee..6fe3302 100644
--- a/SteamWareLib/memLayer.cs
+++ b/SteamWareLib/memLayer.cs
@@ -24,6 +24,8 @@ namespace SteamWare
#endregion oggetti protected utilizzati
+ #region Public Fields
+
///
/// oggetto singleton x accesso al layer di memoria
///
@@ -39,6 +41,12 @@ namespace SteamWare
///
public DS_UtilityTableAdapters.ConfigTmpTableAdapter taConfigTmp;
+ #endregion Public Fields
+
+
+
+ #region Protected Constructors
+
///
/// classe gestione accessi a Session, cache, viewstate, configuration...
///
@@ -52,16 +60,11 @@ namespace SteamWare
setupMongo();
}
- ///
- /// Verifica se si debba serializzare ogni valore complesso (tabelle/righe) in sessione (per impiego di sessioni avanzate come Redis)
- ///
- public bool serializeSession
- {
- get
- {
- return CRB("serializeSession");
- }
- }
+ #endregion Protected Constructors
+
+
+
+ #region Protected Properties
///
/// stringa conn x DB CONF
@@ -86,6 +89,19 @@ namespace SteamWare
}
}
+ #endregion Protected Properties
+
+ ///
+ /// Verifica se si debba serializzare ogni valore complesso (tabelle/righe) in sessione (per impiego di sessioni avanzate come Redis)
+ ///
+ public bool serializeSession
+ {
+ get
+ {
+ return CRB("serializeSession");
+ }
+ }
+
///
/// init dei table adapters
///
@@ -169,6 +185,80 @@ namespace SteamWare
}
}
+ ///
+ /// carica in ram oggetto AppConf
+ ///
+ ///
+ protected Dictionary ricaricaAppConf()
+ {
+ Dictionary answ = new Dictionary();
+ // istanzio un NUOVO oggetto x evitare problemi init contestuali
+ memLayer nML = new memLayer();
+ var tabDati = nML.taConfig.GetData();
+ // carico
+ foreach (DS_Utility.ConfigRow riga in tabDati)
+ {
+ try
+ {
+ answ.Add(riga.chiave, riga.valore);
+ }
+ catch (Exception exc)
+ {
+ logger.lg.scriviLog(string.Format("Errore procedura ricaricaAppConf per kvp: {0} / {1}{2}{3}", riga.chiave, riga.valore, Environment.NewLine, exc), tipoLog.EXCEPTION);
+ }
+ }
+ // log ricarica
+ logger.lg.scriviLog(string.Format("Effettuata procedura ricaricaAppConf per {0} records", answ.Count), tipoLog.INFO);
+ return answ;
+ }
+
+ ///
+ /// avvio oggetto AppConf in ram
+ ///
+ protected void startupAppConf()
+ {
+ // SOLO SE ho la chiave x abilitare config su DB...
+ if (confReadString("DbConfConnectionString") != "")
+ {
+ try
+ {
+ if (redKeyPresent(ACBH))
+ {
+ AppConf = new Dictionary();
+ foreach (var item in redGetHash(ACBH))
+ {
+ if (AppConf.ContainsKey(item.Key))
+ {
+ AppConf[item.Key] = item.Value;
+ }
+ else
+ {
+ AppConf.Add(item.Key, item.Value);
+ }
+ }
+ }
+ else
+ {
+ AppConf = ricaricaAppConf();
+ KeyValuePair[] valori = new KeyValuePair[AppConf.Count];
+ int i = 0;
+ foreach (var item in AppConf)
+ {
+ valori[i] = new KeyValuePair(item.Key, item.Value);
+ i++;
+ }
+ // salvo in redis valori (con TTL)
+ redSaveHash(ACBH, valori, maxAgeAppConf);
+ logger.lg.scriviLog("Completato procedura startupAppConf ", tipoLog.INFO);
+ }
+ }
+ catch (Exception exc)
+ {
+ logger.lg.scriviLog(string.Format("Errore in startupAppConf:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
+ }
+ }
+ }
+
///
/// Configurations da tabella DB Config (short form wrapper)
///
@@ -289,80 +379,6 @@ namespace SteamWare
startupAppConf();
}
- ///
- /// carica in ram oggetto AppConf
- ///
- ///
- protected Dictionary ricaricaAppConf()
- {
- Dictionary answ = new Dictionary();
- // istanzio un NUOVO oggetto x evitare problemi init contestuali
- memLayer nML = new memLayer();
- var tabDati = nML.taConfig.GetData();
- // carico
- foreach (DS_Utility.ConfigRow riga in tabDati)
- {
- try
- {
- answ.Add(riga.chiave, riga.valore);
- }
- catch (Exception exc)
- {
- logger.lg.scriviLog(string.Format("Errore procedura ricaricaAppConf per kvp: {0} / {1}{2}{3}", riga.chiave, riga.valore, Environment.NewLine, exc), tipoLog.EXCEPTION);
- }
- }
- // log ricarica
- logger.lg.scriviLog(string.Format("Effettuata procedura ricaricaAppConf per {0} records", answ.Count), tipoLog.INFO);
- return answ;
- }
-
- ///
- /// avvio oggetto AppConf in ram
- ///
- protected void startupAppConf()
- {
- // SOLO SE ho la chiave x abilitare config su DB...
- if (confReadString("DbConfConnectionString") != "")
- {
- try
- {
- if (redKeyPresent(ACBH))
- {
- AppConf = new Dictionary();
- foreach (var item in redGetHash(ACBH))
- {
- if (AppConf.ContainsKey(item.Key))
- {
- AppConf[item.Key] = item.Value;
- }
- else
- {
- AppConf.Add(item.Key, item.Value);
- }
- }
- }
- else
- {
- AppConf = ricaricaAppConf();
- KeyValuePair[] valori = new KeyValuePair[AppConf.Count];
- int i = 0;
- foreach (var item in AppConf)
- {
- valori[i] = new KeyValuePair(item.Key, item.Value);
- i++;
- }
- // salvo in redis valori (con TTL)
- redSaveHash(ACBH, valori, maxAgeAppConf);
- logger.lg.scriviLog("Completato procedura startupAppConf ", tipoLog.INFO);
- }
- }
- catch (Exception exc)
- {
- logger.lg.scriviLog(string.Format("Errore in startupAppConf:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
- }
- }
- }
-
#endregion area gestione config su DB
#region utility gestione conf settings
@@ -1408,6 +1424,11 @@ namespace SteamWare
ValDesc
}
+ ///
+ /// Oggetto currentDb locale
+ ///
+ private IDatabase _currDB { get; set; }
+
///
/// Oggetto DB REDIS corrente
///
@@ -1483,9 +1504,26 @@ namespace SteamWare
}
///
- /// Oggetto currentDb locale
+ /// Effettua comaprazione x CHIAVE in KVP ASC
///
- private IDatabase _currDB { get; set; }
+ ///
+ ///
+ ///
+ private int CompareKey(KeyValuePair x, KeyValuePair y)
+ {
+ return x.Key.CompareTo(y.Key);
+ }
+
+ ///
+ /// Effettua comaprazione x CHIAVE in KVP DESC
+ ///
+ ///
+ ///
+ ///
+ private int CompareKeyDesc(KeyValuePair x, KeyValuePair y)
+ {
+ return y.Key.CompareTo(x.Key);
+ }
///
/// Effettua comaprazione x VALORE in KVP ASC
@@ -1852,7 +1890,7 @@ namespace SteamWare
}
catch (Exception exc)
{
- Log.Instance.Error(exc, $"{exc}", tipoLog.EXCEPTION);
+ SteamWare.Logger.Logging.LogException(exc, Logger.Constants.ERROR_LEVEL.Error);
}
return answ;
}
@@ -2251,28 +2289,6 @@ namespace SteamWare
return answ;
}
- ///
- /// Effettua comaprazione x CHIAVE in KVP ASC
- ///
- ///
- ///
- ///
- private int CompareKey(KeyValuePair x, KeyValuePair y)
- {
- return x.Key.CompareTo(y.Key);
- }
-
- ///
- /// Effettua comaprazione x CHIAVE in KVP DESC
- ///
- ///
- ///
- ///
- private int CompareKeyDesc(KeyValuePair x, KeyValuePair y)
- {
- return y.Key.CompareTo(x.Key);
- }
-
#endregion gestione valori in RedisCache
#region URL corretti immagini
@@ -2313,6 +2329,14 @@ namespace SteamWare
}
}
+ ///
+ /// Init accesso MongoDb
+ ///
+ private void setupMongo()
+ {
+ currMongoClient = new MongoClient(mongoConnString);
+ }
+
///
/// Restituisce oggetto DB richiesto
///
@@ -2324,14 +2348,6 @@ namespace SteamWare
return answ;
}
- ///
- /// Init accesso MongoDb
- ///
- private void setupMongo()
- {
- currMongoClient = new MongoClient(mongoConnString);
- }
-
#endregion gestione mongoDb
}
}
\ No newline at end of file