|
67 | 67 | expect(log_event[:attributes]["sentry.message.parameter.1"]).to eql({ value: "Monday", type: "string" }) |
68 | 68 | end |
69 | 69 |
|
| 70 | + it "logs with nested hash attributes" do |
| 71 | + attributes = { number: 312, string: "hello" } |
| 72 | + |
| 73 | + Sentry.logger.public_send(level, "Hello world", extra: attributes) |
| 74 | + |
| 75 | + expect(sentry_logs).to_not be_empty |
| 76 | + |
| 77 | + log_event = sentry_logs.last |
| 78 | + |
| 79 | + expect(log_event[:level]).to eql(level) |
| 80 | + expect(log_event[:attributes][:extra]).to eql({ type: "string", value: attributes.to_json }) |
| 81 | + end |
| 82 | + |
| 83 | + it "logs with array attributes" do |
| 84 | + attributes = [1, 2, 3, "hello"] |
| 85 | + |
| 86 | + Sentry.logger.public_send(level, "Hello world", extra: attributes) |
| 87 | + |
| 88 | + expect(sentry_logs).to_not be_empty |
| 89 | + |
| 90 | + log_event = sentry_logs.last |
| 91 | + |
| 92 | + expect(log_event[:level]).to eql(level) |
| 93 | + expect(log_event[:attributes][:extra]).to eql({ type: "string", value: attributes.to_json }) |
| 94 | + end |
| 95 | + |
| 96 | + it "logs with date in attributes" do |
| 97 | + attributes = Date.today |
| 98 | + |
| 99 | + Sentry.logger.public_send(level, "Hello world", extra: attributes) |
| 100 | + |
| 101 | + expect(sentry_logs).to_not be_empty |
| 102 | + |
| 103 | + log_event = sentry_logs.last |
| 104 | + |
| 105 | + expect(log_event[:level]).to eql(level) |
| 106 | + expect(log_event[:attributes][:extra]).to eql({ type: "string", value: attributes.to_json }) |
| 107 | + end |
| 108 | + |
70 | 109 | it "logs with hash-based template parameters" do |
71 | 110 | Sentry.logger.public_send(level, "Hello %{name}, it is %{day}", name: "Jane", day: "Monday") |
72 | 111 |
|
|
0 commit comments