/// <summary> /// Create a new property end point. /// </summary> /// <param name="propertyOwner">The object owning the bound property.</param> /// <param name="propertyName">The string name of the property.</param> /// <param name="adapter">Adapter (can be null for no adapter).</param> /// <param name="options">Adapter options (can be null for adapters that do not /// require options or if there is no adapter).</param> /// <param name="endPointType">The string name of the type of the object /// containing the bound property.</param> /// <param name="context">Unity component that the property is connected to, used /// so that clicking an error message in the log will highlight the relevant /// component in the scene.</param> public PropertyEndPoint( object propertyOwner, string propertyName, IAdapterInfo adapter, AdapterOptions options, string endPointType, Component context) { this.propertyOwner = propertyOwner; this.adapter = adapter; this.adapterOptions = options; var type = propertyOwner.GetType(); if (string.IsNullOrEmpty(propertyName)) { Debug.LogError( "Property not specified for type '" + type + "'.", context ); return; } this.propertyName = propertyName; this.property = type.GetProperty(propertyName); if (this.property == null) { Debug.LogError( "Property '" + propertyName + "' not found on " + endPointType + " '" + type + "'.", context ); } }
public static bool TryGetAdapter(string adapterId, out IAdapterInfo adapterInfo) { if (string.IsNullOrEmpty(adapterId)) { adapterInfo = null; return(false); } return(Adapters.TryGetValue(adapterId, out adapterInfo)); }
public static void RegisterAdapter(IAdapterInfo adapter) { if (adapter == null) { throw new ArgumentNullException(nameof(adapter)); } if (Adapters.ContainsKey(adapter.Id)) { return; } Adapters.Add(adapter.Id, adapter); }
public OutputLogger(IMessageLogger messageLogger, IAdapterInfo adapterInfo, IAdapterSettings settings) { this.MessageLogger = messageLogger; adapterPrefix = String.Format("{0} {1}", adapterInfo.Name, adapterInfo.Version); var settingsToLogLevelMap = new Dictionary <string, int>() { { "trace", traceLogLevel }, { "debug", debugLogLevel }, { "info", infoLogLevel }, { "warning", warningLogLevel }, { "error", errorLogLevel }, }; const string defaultSetting = "info"; string textLogLevel = (settings.LogLevel != null ? settings.LogLevel.ToLower() : defaultSetting); minLogLevel = settingsToLogLevelMap.ContainsKey(textLogLevel) ? settingsToLogLevelMap[textLogLevel] : settingsToLogLevelMap[defaultSetting]; }
public LoggerFactory(IAdapterInfo adapterInfo) { this.adapterInfo = adapterInfo; }