-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
33deca8
commit 712b048
Showing
10 changed files
with
195 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
FluentlySharepoint/FluentlySharePoint/Helpers/DictionaryExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace KeenMate.FluentlySharePoint | ||
{ | ||
public static class DictionaryExtensions | ||
{ | ||
public static void AddOrUpdate<Tkey, Tvalue>(this Dictionary<Tkey, Tvalue> dictionary, Tkey key, Tvalue value) | ||
{ | ||
if (dictionary.ContainsKey(key)) | ||
{ | ||
dictionary[key] = value; | ||
} | ||
else | ||
{ | ||
dictionary.Add(key, value); | ||
} | ||
} | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
FluentlySharepoint/FluentlySharePoint/Loggers/ConsoleLogger.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
using System; | ||
using KeenMate.FluentlySharePoint.Interfaces; | ||
|
||
namespace KeenMate.FluentlySharePoint.Loggers | ||
{ | ||
/// <summary> | ||
/// Dummy console logger | ||
/// </summary> | ||
public class ConsoleLogger : ILogger | ||
{ | ||
public static string DateTimeFormat = "yyyy-MM-dd HH:mm:ss.ffff"; | ||
|
||
public void WriteLineInColor(string message, ConsoleColor color) | ||
{ | ||
Console.ForegroundColor = color; | ||
Console.WriteLine($"{DateTime.Now.ToString(DateTimeFormat)} - {message}"); | ||
Console.ResetColor(); | ||
} | ||
|
||
public void Trace(string message) | ||
{ | ||
WriteLineInColor(message, ConsoleColor.Gray); | ||
} | ||
|
||
public void Debug(string message) | ||
{ | ||
WriteLineInColor(message, ConsoleColor.DarkGray); | ||
} | ||
|
||
public void Info(string message) | ||
{ | ||
WriteLineInColor(message, ConsoleColor.Cyan); | ||
} | ||
|
||
public void Warn(string message) | ||
{ | ||
WriteLineInColor(message, ConsoleColor.Yellow); | ||
} | ||
|
||
public void Warn(Exception ex, string message) | ||
{ | ||
WriteLineInColor($"{message} - {ex}", ConsoleColor.Yellow); | ||
} | ||
|
||
public void Error(string message) | ||
{ | ||
WriteLineInColor($"{message}", ConsoleColor.Red); | ||
} | ||
|
||
public void Error(Exception ex, string message) | ||
{ | ||
WriteLineInColor($"{message} - {ex}", ConsoleColor.Red); | ||
} | ||
|
||
public void Fatal(string message) | ||
{ | ||
WriteLineInColor($"{message}", ConsoleColor.DarkRed); | ||
} | ||
|
||
public void Fatal(Exception ex, string message) | ||
{ | ||
WriteLineInColor($"{message} - {ex}", ConsoleColor.DarkRed); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.