lib/async/logger.rb in async-1.16.0 vs lib/async/logger.rb in async-1.17.0
- old
+ new
@@ -17,9 +17,15 @@
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
require 'event/console'
+require_relative 'task'
module Async
- extend Event::Console
+ # @return the current logger, either the active tasks logger, or the global event console logger.
+ def self.logger
+ if task = Task.current?
+ task.logger
+ end || Event::Console.logger
+ end
end