-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from jessedoyle/crystal-0.34
Crystal >= 0.34 | Release 0.20.0
- Loading branch information
Showing
16 changed files
with
83 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
name: duktape | ||
version: 0.19.1 | ||
version: 0.20.0 | ||
|
||
authors: | ||
- Jesse Doyle <jdoyle@ualberta.ca> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,3 @@ | ||
def last_stack_type(ctx) | ||
LibDUK.get_type(ctx.raw, -1) | ||
end | ||
|
||
def log_debug | ||
Duktape.logger.level = Logger::Severity::DEBUG | ||
yield | ||
Duktape.logger.level = Logger::Severity::UNKNOWN | ||
end | ||
|
||
def print_stack!(ctx) | ||
log_debug do | ||
ctx.dump! | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
require "../lib_duktape" | ||
require "./support/*" | ||
require "./log" | ||
require "./builtin/base" | ||
require "./context" | ||
require "./error" | ||
require "./logger" | ||
require "./sandbox" | ||
require "./version" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# log.cr: crystal >= 0.34 log implementation | ||
# | ||
# Copyright (c) 2020 Jesse Doyle. All rights reserved. | ||
# | ||
# This is free software. Please see LICENSE for details. | ||
|
||
require "log" | ||
require "json" | ||
|
||
Log.setup_from_env( | ||
level: ENV.fetch("CRYSTAL_LOG_LEVEL", "INFO"), | ||
sources: ENV.fetch("CRYSTAL_LOG_SOURCES", "duktape.*"), | ||
backend: Log::IOBackend.new.tap do |backend| | ||
backend.formatter = Duktape::Log.formatter | ||
end | ||
) | ||
|
||
module Duktape | ||
module Log | ||
Base = ::Log.for("duktape") | ||
Alert = ::Log.for("duktape.alert") | ||
Console = ::Log.for("duktape.console") | ||
|
||
@@formatter : ::Log::Formatter? | ||
|
||
def self.formatter | ||
@@formatter ||= ::Log::Formatter.new do |entry, io| | ||
timestamp = Time::Format::ISO_8601_DATE_TIME.format(time: entry.timestamp) | ||
|
||
if entry.exception | ||
exception = entry.exception.class.name | ||
else | ||
exception = nil | ||
end | ||
|
||
io << { | ||
exception: exception, | ||
message: entry.message, | ||
severity: entry.severity.label, | ||
source: entry.source, | ||
timestamp: timestamp, | ||
}.to_json | ||
end | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters