77
88namespace Olympus {
99 public class CmdGetModIdToNameMap : Cmd < string , bool , bool > {
10+ private static readonly Logger log = new Logger ( nameof ( CmdGetModIdToNameMap ) ) ;
11+
1012 public override bool Taskable => true ;
1113
1214 private static string cacheLocation ;
@@ -15,7 +17,7 @@ public class CmdGetModIdToNameMap : Cmd<string, bool, bool> {
1517 public override bool Run ( string cacheLocation , bool apiMirror ) {
1618 CmdGetModIdToNameMap . cacheLocation = cacheLocation ;
1719 CmdGetModIdToNameMap . apiMirror = apiMirror ;
18- Console . Error . WriteLine ( $ "[CmdGetIdToNameMap] Cache location set to: { cacheLocation } ") ;
20+ log . Debug ( $ "Cache location set to: { cacheLocation } ") ;
1921 GetModIDsToNamesMap ( ignoreCache : true ) ;
2022 return true ;
2123 }
@@ -26,7 +28,7 @@ internal static Dictionary<string, string> GetModIDsToNamesMap(bool ignoreCache
2628 Dictionary < string , string > map ;
2729
2830 if ( ! ignoreCache && File . Exists ( cacheLocation ) ) {
29- Console . Error . WriteLine ( $ "[CmdGetIdToNameMap] Loading mod IDs from { cacheLocation } ") ;
31+ log . Debug ( $ "Loading mod IDs from { cacheLocation } ") ;
3032 map = tryRun ( ( ) => {
3133 lock ( locker )
3234 using ( Stream inputStream = new FileStream ( cacheLocation , FileMode . Open ) ) {
@@ -36,7 +38,7 @@ internal static Dictionary<string, string> GetModIDsToNamesMap(bool ignoreCache
3638 if ( map . Count > 0 ) return map ;
3739 }
3840
39- Console . Error . WriteLine ( $ "[CmdGetIdToNameMap] Loading mod IDs from the Internet") ;
41+ log . Debug ( $ "[CmdGetIdToNameMap] Loading mod IDs from the Internet (apiMirror = { apiMirror } ) ") ;
4042 map = tryRun ( ( ) => {
4143 using ( HttpClient wc = new HttpClientWithCompressionSupport ( ) )
4244 using ( Stream inputStream = wc . GetAsync (
@@ -53,8 +55,7 @@ private static Dictionary<string, string> tryRun(Func<Dictionary<string, string>
5355 try {
5456 return function ( ) ;
5557 } catch ( Exception e ) {
56- Console . Error . WriteLine ( "Error loading mod IDs to names list" ) ;
57- Console . Error . WriteLine ( e ) ;
58+ log . Warning ( "Error loading mod IDs to names list: " + e ) ;
5859 return new Dictionary < string , string > ( ) ;
5960 }
6061 }
0 commit comments