Skip to content

Commit 8dc26b5

Browse files
committed
Make code compatible with Ruby-only apps
1 parent b2f9e39 commit 8dc26b5

File tree

1 file changed

+13
-7
lines changed
  • lib/semantic_logger/formatters

1 file changed

+13
-7
lines changed

lib/semantic_logger/formatters/loki.rb

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,20 @@ def exception
137137
end
138138

139139
def stringify_hash(hash)
140-
hash.stringify_keys.transform_values do |value|
141-
case value
142-
when Hash
143-
stringify_hash(value).to_json
144-
else
145-
value.to_s
146-
end
140+
result = {}
141+
142+
hash.each do |key, value|
143+
string_key = key.to_s
144+
145+
result[string_key] = case value
146+
when Hash
147+
JSON.generate(stringify_hash(value))
148+
else
149+
value.to_s
150+
end
147151
end
152+
153+
result
148154
end
149155
end
150156
end

0 commit comments

Comments
 (0)