Skip to content

Commit b4814ee

Browse files
Log attributes
1 parent 9e2fa56 commit b4814ee

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

Agent/Analytics/PersistentEventStore.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,15 @@ - (void)setObject:(nonnull id)object forKey:(nonnull id)key {
5656
@synchronized (store) {
5757
store[key] = object;
5858
_dirty = YES;
59-
NRLOG_VERBOSE(@"Marked dirty for adding");
59+
NRLOG_AUDIT(@"Marked dirty for adding");
6060
}
6161

62-
NRLOG_VERBOSE(@"Scheduling block");
62+
NRLOG_AUDIT(@"Scheduling block");
6363
[self performWrite: ^ {
64-
NRLOG_VERBOSE(@"Entered block");
64+
NRLOG_AUDIT(@"Entered block");
6565
@synchronized (self) {
6666
if(!self->_dirty) {
67-
NRLOG_VERBOSE(@"Not writing file because it's not dirty");
67+
NRLOG_AUDIT(@"Not writing file because it's not dirty");
6868
return;
6969
}
7070
}
@@ -157,7 +157,7 @@ - (void)saveToFile {
157157
if(!success) {
158158
NRLOG_ERROR(@"Error saving data: %@", error.description);
159159
} else {
160-
NRLOG_VERBOSE(@"Wrote file");
160+
NRLOG_AUDIT(@"Wrote file");
161161
_lastSave = [NSDate new];
162162
}
163163
}

Test Harness/NRTestApp/NRTestApp/ViewModels/UtilViewModel.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ class UtilViewModel {
4444
options.append(UtilOption(title: "Notice Network Failure", handler: { [self] in noticeFailedNWRequest()}))
4545

4646
options.append(UtilOption(title: "Test Log Dict", handler: { [self] in testLogDict()}))
47+
options.append(UtilOption(title: "Test Log Error", handler: { [self] in testLogError()}))
48+
options.append(UtilOption(title: "Test Log Attributes", handler: { [self] in testLogAttributes()}))
4749

4850
options.append(UtilOption(title: "Make 100 Logs", handler: { [self] in make100Logs()}))
4951
options.append(UtilOption(title: "Make 100 Special Character Logs", handler: { [self] in make100SpecialCharacterLogs()}))
@@ -138,7 +140,22 @@ class UtilViewModel {
138140
"message": "This is a test message for the New Relic logging system."
139141
])
140142
}
143+
func testLogError() {
141144

145+
do {
146+
try errorMethod()
147+
} catch {
148+
NewRelic.logErrorObject(error)
149+
}
150+
}
151+
152+
// TODO: Wrap up attributes handling as a part of NR-227300
153+
func testLogAttributes() {
154+
NewRelic.logAttributes([
155+
"logLevel": "WARN",
156+
"message": "This is a test message for the New Relic logging system."
157+
])
158+
}
142159

143160

144161
func noticeNWRequest() {

0 commit comments

Comments
 (0)