/// <summary> /// Change the logging level /// /// 'ipfs log level' is a utility command used to change the logging /// output of a running daemon. /// </summary> /// <param name="subsystem">the subsystem logging identifier. Use 'all' for all subsystems.</param> /// <param name="level">one of: debug, info, notice, warning, error, critical</param> /// <returns>Confirmation message</returns> public async Task <string> Level(string subsystem, IpfsLogLevel level) { string levelValue = null; switch (level) { case IpfsLogLevel.Debug: levelValue = "debug"; break; case IpfsLogLevel.Info: levelValue = "info"; break; case IpfsLogLevel.Notice: levelValue = "notice"; break; case IpfsLogLevel.Warning: levelValue = "warning"; break; case IpfsLogLevel.Error: levelValue = "error"; break; case IpfsLogLevel.Critical: levelValue = "critical"; break; default: break; } HttpContent content = await ExecuteGetAsync("level", new[] { subsystem, levelValue }); string json = await content.ReadAsStringAsync(); if (String.IsNullOrEmpty(json)) { return(String.Empty); } var jsonDict = _jsonSerializer.Deserialize <Dictionary <string, string> >(json); return(jsonDict["Message"]); }
/// <summary> /// Change the logging level /// /// 'ipfs log level' is a utility command used to change the logging /// output of a running daemon. /// </summary> /// <param name="subsystem">the subsystem logging identifier. Use 'all' for all subsystems.</param> /// <param name="level">one of: debug, info, notice, warning, error, critical</param> /// <returns>Confirmation message</returns> public async Task<string> Level(string subsystem, IpfsLogLevel level) { string levelValue = null; switch (level) { case IpfsLogLevel.Debug: levelValue = "debug"; break; case IpfsLogLevel.Info: levelValue = "info"; break; case IpfsLogLevel.Notice: levelValue = "notice"; break; case IpfsLogLevel.Warning: levelValue = "warning"; break; case IpfsLogLevel.Error: levelValue = "error"; break; case IpfsLogLevel.Critical: levelValue = "critical"; break; default: break; } HttpContent content = await ExecuteGetAsync("level", new[] { subsystem, levelValue }); string json = await content.ReadAsStringAsync(); if(String.IsNullOrEmpty(json)) { return String.Empty; } var jsonDict = _jsonSerializer.Deserialize<Dictionary<string, string>>(json); return jsonDict["Message"]; }