/// <summary> /// Binds the context to the current thread. /// </summary> public void Bind() { if (this.IsBound) { throw new InvalidOperationException("Context is already bound."); } if (InnerLog == null) { throw new InvalidOperationException("InnerLog is null."); } // bind, if we have a proper log... if (!(this.InnerLog is NullLog)) { LogSet.BindToContext(this.InnerLog); } _isBound = true; }
/// <summary> /// Unbinds the context from the current thread. /// </summary> public void Unbind() { if (InnerLog == null) { throw new InvalidOperationException("InnerLog is null."); } // unbind? if (this.IsBound) { _isBound = false; // unbind, if we have a proper log... if (!(this.InnerLog is NullLog)) { LogSet.UnbindFromContext(this.InnerLog); } } }