namespace Sony.Filtr.Tasks.EventSource { public class ApolloUpdatePlaylistInfoEventSource : System.Diagnostics.Tracing.EventSource { public static readonly ApolloUpdatePlaylistInfoEventSource Log = new ApolloUpdatePlaylistInfoEventSource(); private ApolloUpdatePlaylistInfoEventSource() { } public void PrepareDataStart() { this.WriteEvent(1); } public void PrepareDataStop() { this.WriteEvent(2); } public void ProcessPlaylistStart(string playlistId, System.Diagnostics.Stopwatch sw, NLog.Logger logger) { sw.Restart(); if (this.IsEnabled()) { this.WriteEvent(3, playlistId); } } public void ProcessPlaylistStop(string playlistId, System.Diagnostics.Stopwatch sw, NLog.Logger logger) { sw.Stop(); logger.Warn($@"UPDATED PLAYLIST {playlistId}. PROCESS TIME: {sw.Elapsed.TotalMilliseconds} milliseconds"); if (this.IsEnabled()) { this.WriteEvent(4, playlistId); } } public void GetSpotifyPlaylistStart(string playlistId) { if (this.IsEnabled()) { this.WriteEvent(5, playlistId); } } public void GetSpotifyPlaylistStop(string playlistId) { if (this.IsEnabled()) { this.WriteEvent(6, playlistId); } } public void RemovePlaylistStart(string playlistId) { if (this.IsEnabled()) { this.WriteEvent(7, playlistId); } } public void RemovePlaylistStop(string playlistId) { if (this.IsEnabled()) { this.WriteEvent(8, playlistId); } } internal void SaveSpotifyPlaylistStart(string playlistId) { if (this.IsEnabled()) { this.WriteEvent(11, playlistId); } } internal void SaveSpotifyPlaylistStop(string playlistId) { if (this.IsEnabled()) { this.WriteEvent(12, playlistId); } } public void UpdateEditorialPlaylistsParallelStart(string playlistId) { if (this.IsEnabled()) { this.WriteEvent(13, playlistId); } } public void UpdateEditorialPlaylistsParallelStop(string playlistId) { if (this.IsEnabled()) { this.WriteEvent(14, playlistId); } } public void PlaylistGetBlockStart(string playlistId, System.Diagnostics.Stopwatch sw, NLog.Logger logger) { sw.Restart(); logger.Warn($"Get Spotify data block START for PLAYLIST {playlistId}. {System.DateTime.Now.ToString("hh:mm:ss fff")}"); if (this.IsEnabled()) { this.WriteEvent(15, playlistId); } } public void PlaylistGetBlockStop(string playlistId, System.Diagnostics.Stopwatch sw, NLog.Logger logger) { sw.Stop(); logger.Warn($"Get Spotify data block END for PLAYLIST {playlistId}. {System.DateTime.Now.ToString("hh:mm:ss fff")} Duration: {sw.Elapsed.TotalMilliseconds} ms"); if (this.IsEnabled()) { this.WriteEvent(16, playlistId); } } public void PlaylistProcessBlockStart(string playlistId, System.Diagnostics.Stopwatch sw, NLog.Logger logger) { sw.Restart(); logger.Warn($"process playlist block START for PLAYLIST {playlistId}. {System.DateTime.Now.ToString("hh:mm:ss fff")}"); if (this.IsEnabled()) { this.WriteEvent(17, playlistId); } } public void PlaylistProcessBlockStop(string playlistId, System.Diagnostics.Stopwatch sw, NLog.Logger logger) { sw.Stop(); logger.Warn($"process playlist block END for PLAYLIST {playlistId}. {System.DateTime.Now.ToString("hh:mm:ss fff")} Duration: {sw.Elapsed.TotalMilliseconds} ms"); if (this.IsEnabled()) { this.WriteEvent(18, playlistId); } } public void PlaylistSaveBlockStart(string playlistId, System.Diagnostics.Stopwatch sw, NLog.Logger logger) { sw.Restart(); logger.Warn($"Save playlist block START for PLAYLIST {playlistId}. {System.DateTime.Now.ToString("hh:mm:ss fff")}"); if (this.IsEnabled()) { this.WriteEvent(19, playlistId); } } public void PlaylistSaveBlockStop(string playlistId, System.Diagnostics.Stopwatch sw, NLog.Logger logger) { sw.Stop(); logger.Warn($"Save playlist block END for PLAYLIST {playlistId}. {System.DateTime.Now.ToString("hh:mm:ss fff")} Duration: {sw.Elapsed.TotalMilliseconds} ms"); if (this.IsEnabled()) { this.WriteEvent(20, playlistId); } } [System.Diagnostics.Tracing.NonEvent] public void PlaylistSaveBlockExceptionStop(string playlistId, System.Diagnostics.Stopwatch sw, NLog.Logger logger, System.Exception ex) { this.PlaylistSaveBlockExceptionStopInternal(playlistId, sw, logger, ex.Message, ex.GetType().Name); } private void PlaylistSaveBlockExceptionStopInternal(string playlistId, System.Diagnostics.Stopwatch sw, NLog.Logger logger, string exceptionMessage, string exceptionType) { sw.Stop(); logger.Error($"Save playlist block END for PLAYLIST {playlistId}. {System.DateTime.Now.ToString("hh:mm:ss fff")} Duration: {sw.Elapsed.TotalMilliseconds} ms. Exception: {exceptionMessage}. ExceptionType: {exceptionType}"); if (this.IsEnabled()) { this.WriteEvent(21, playlistId, exceptionMessage, exceptionType); } } [System.Diagnostics.Tracing.NonEvent] public void ProcessPlaylistException(string playlistId, System.Diagnostics.Stopwatch sw, NLog.Logger logger, System.Exception ex) { this.ProcessPlaylistExceptionInternal(playlistId, sw, logger, ex.Message, ex.GetType().Name); } private void ProcessPlaylistExceptionInternal(string playlistId, System.Diagnostics.Stopwatch sw, NLog.Logger logger, string exceptionMessage, string exceptionType) { sw.Stop(); logger.Error($@"UPDATED PLAYLIST {playlistId} FAILED. PROCESS TIME: {sw.Elapsed.TotalMilliseconds} ms. Exception: {exceptionMessage}. ExceptionType: {exceptionType}"); if (this.IsEnabled()) { this.WriteEvent(22, playlistId, exceptionMessage, exceptionType); } } [System.Diagnostics.Tracing.NonEvent] public void PlaylistGetBlockException(string playlistId, System.Diagnostics.Stopwatch sw, NLog.Logger logger, System.Exception ex) { this.PlaylistGetBlockExceptionInternal(playlistId, sw, logger, ex.Message, ex.GetType().Name); } private void PlaylistGetBlockExceptionInternal(string playlistId, System.Diagnostics.Stopwatch sw, NLog.Logger logger, string exceptionMessage, string exceptionType) { sw.Stop(); logger.Error($"Get Spotify data block END for PLAYLIST {playlistId}. {System.DateTime.Now.ToString("hh:mm:ss fff")} Duration: {sw.Elapsed.TotalMilliseconds} ms. Exception: {exceptionMessage}. ExceptionType: {exceptionType}"); if (this.IsEnabled()) { this.WriteEvent(23, playlistId, exceptionMessage, exceptionType); } } } }