Skip to content

Commit 200c66b

Browse files
committed
General bug fixes and Added a sample index file to be used for testing.
1 parent 2b89399 commit 200c66b

File tree

3 files changed

+46
-13
lines changed

3 files changed

+46
-13
lines changed

src/exceptionless-spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ module Exceptionless {
5959
expect(config.storage.count()).toBe(0);
6060
});
6161

62-
/*
6362
it('should suspend processing', (done) => {
6463
var config = new Configuration('LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw', 'http://localhost:50000');
6564
expect(config.storage.count()).toBe(0);
@@ -74,7 +73,6 @@ module Exceptionless {
7473
done();
7574
}, 10000);
7675
}, 21000);
77-
*/
7876
});
7977

8078
describe('SubmissionClient', () => {

src/exceptionless.ts

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ module Exceptionless {
179179
}
180180

181181
var key = this.queuePath() + '-' + new Date().toJSON() + '-' + Math.floor(Math.random() * 9007199254740992);
182+
this._config.log.info('Enqueuing event: ' + key);
182183
return this._config.storage.save(key, event);
183184
}
184185

@@ -197,16 +198,17 @@ module Exceptionless {
197198

198199
try {
199200
var events = this._config.storage.get(this.queuePath(), this._config.submissionBatchSize);
200-
if (events.length == 0) {
201+
if (!events || events.length == 0) {
201202
this._config.log.info('There are currently no queued events to process.');
202203
return;
203204
}
204205

206+
this._config.log.info('Sending ' + events.length + ' events to ' + this._config.serverUrl + '.');
205207
this._config.submissionClient.submit(events, this._config)
206208
.then(
207209
(response:SubmissionResponse) => {
208210
if (response.success) {
209-
this._config.log.info('Sent ' + events.length + ' events to "' + this._config.serverUrl + '".');
211+
this._config.log.info('Sent ' + events.length + ' events to ' + this._config.serverUrl + '.');
210212
} else if (response.serviceUnavailable) {
211213
// You are currently over your rate limit or the servers are under stress.
212214
this._config.log.error('Server returned service unavailable.');
@@ -257,8 +259,6 @@ module Exceptionless {
257259
}
258260

259261
private onProcessQueue() {
260-
return false;
261-
262262
if (!this.isQueueProcessingSuspended() && !this._processingQueue) {
263263
this.process();
264264
}
@@ -271,7 +271,6 @@ module Exceptionless {
271271

272272
this._config.log.info('Suspending processing for ' + durationInMinutes + 'minutes.');
273273
this._suspendProcessingUntil = new Date(new Date().getTime() + (durationInMinutes * 60000));
274-
//_queueTimer.Change(duration.Value, _processQueueInterval);
275274

276275
if (discardFutureQueuedItems) {
277276
this._discardQueuedItemsUntil = new Date(new Date().getTime() + (durationInMinutes * 60000));
@@ -288,7 +287,9 @@ module Exceptionless {
288287
}
289288

290289
private requeueEvents(events:IEvent[]) {
291-
for (var event in events || []) {
290+
this._config.log.info('Requeuing ' + events.length + ' events.');
291+
292+
for (var event in events) {
292293
this.enqueue(event);
293294
}
294295
}
@@ -560,12 +561,18 @@ module Exceptionless {
560561
}
561562

562563
public setType(type:string): EventBuilder {
563-
this.target.type = type;
564+
if (type && type.length > 0) {
565+
this.target.type = type;
566+
}
567+
564568
return this;
565569
}
566570

567571
public setSource(source:string): EventBuilder {
568-
this.target.source = source;
572+
if (source && source.length > 0) {
573+
this.target.source = source;
574+
}
575+
569576
return this;
570577
}
571578

@@ -588,7 +595,10 @@ module Exceptionless {
588595
}
589596

590597
public setMessage(message:string): EventBuilder {
591-
this.target.message = message;
598+
if (message && message.length > 0) {
599+
this.target.message = message;
600+
}
601+
592602
return this;
593603
}
594604

@@ -603,12 +613,15 @@ module Exceptionless {
603613
}
604614

605615
public setValue(value:number): EventBuilder {
606-
this.target.value = value;
616+
if (value) {
617+
this.target.value = value;
618+
}
619+
607620
return this;
608621
}
609622

610623
public addTags(...tags:string[]): EventBuilder {
611-
if (tags == null || tags.length === 0) {
624+
if (!tags || tags.length === 0) {
612625
return this;
613626
}
614627

src/index.html

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head lang="en">
4+
<meta charset="UTF-8">
5+
<title>Exceptionless Test</title>
6+
</head>
7+
<body>
8+
<script type="application/javascript" src="exceptionless.js"></script>
9+
<script type="application/javascript">
10+
"use strict"
11+
12+
var Exceptionless;
13+
(function (Exceptionless) {
14+
client.config.log = new Exceptionless.ConsoleLog();
15+
client.submitFeatureUsage('JavaScript');
16+
client.submitLog('Log Message From JavaScript');
17+
client.createLog('Index', 'Log Message from JS', 'Info').setProperty('Blake', 'Is Awesome!').submit();
18+
})(Exceptionless || (Exceptionless = {}));
19+
</script>
20+
</body>
21+
</html>
22+

0 commit comments

Comments
 (0)