Skip to content

Commit 741507b

Browse files
committed
Updates for node.
1 parent c4bb51a commit 741507b

16 files changed

+232
-36
lines changed

dist/exceptionless.es5.d.ts

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ export declare class InMemoryLastReferenceIdManager implements ILastReferenceIdM
5050
clearLast(): void;
5151
setLast(eventId: string): void;
5252
}
53+
export declare class ConsoleLog implements ILog {
54+
info(message: any): void;
55+
warn(message: any): void;
56+
error(message: any): void;
57+
}
5358
export declare class NullLog implements ILog {
5459
info(message: any): void;
5560
warn(message: any): void;
@@ -138,7 +143,9 @@ export declare class Configuration implements IConfigurationSettings {
138143
addPlugin(name: string, priority: number, pluginAction: (context: EventPluginContext) => void): void;
139144
removePlugin(plugin: IEventPlugin): void;
140145
removePlugin(name: string): void;
146+
setVersion(version: string): void;
141147
useReferenceIds(): void;
148+
useDebugLogger(): void;
142149
private static _defaultSettings;
143150
static defaults: IConfigurationSettings;
144151
}
@@ -339,8 +346,28 @@ export declare class WindowBootstrapper implements IBootstrapper {
339346
private getDefaultsSettingsFromScriptTag();
340347
private handleWindowOnError();
341348
}
342-
export declare class ConsoleLog implements ILog {
343-
info(message: any): void;
344-
warn(message: any): void;
345-
error(message: any): void;
349+
export interface IEnvironmentInfo {
350+
processor_count?: number;
351+
total_physical_memory?: number;
352+
available_physical_memory?: number;
353+
command_line?: string;
354+
process_name?: string;
355+
process_id?: string;
356+
process_memory_size?: number;
357+
thread_id?: string;
358+
architecture?: string;
359+
o_s_name?: string;
360+
o_s_version?: string;
361+
ip_address?: string;
362+
machine_name?: string;
363+
install_id?: string;
364+
runtime_version?: string;
365+
data?: any;
366+
}
367+
export interface IEnvironmentInfoCollector {
368+
GetEnvironmentInfo(): IEnvironmentInfo;
369+
}
370+
export declare class NodeEnvironmentInfoCollector implements IEnvironmentInfoCollector {
371+
GetEnvironmentInfo(): IEnvironmentInfo;
372+
private getIpAddresses();
346373
}

dist/exceptionless.es5.js

Lines changed: 77 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/exceptionless.es5.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/exceptionless.es5.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/exceptionless.es5.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
var client = Exceptionless.ExceptionlessClient.default;
1616
client.config.serverUrl = 'http://localhost:50000';
17-
client.config.log = new Exceptionless.ConsoleLog();
17+
client.config.useDebugLogger();
1818
</script>
1919

2020
<button onclick="throwDivisionByZero()">Division By Zero</button>

src/ExceptionlessClient.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
// TODO: Verify that stack traces are parsed properly.
2-
// TODO: Handle Server Settings
3-
// TODO: Lock configuration.
4-
// TODO: Look into using templated strings `${1 + 1}`.
5-
61
import { IConfigurationSettings } from './configuration/IConfigurationSettings';
72
import { Configuration } from './configuration/Configuration';
83
import { EventBuilder } from './EventBuilder';

src/bootstrap/NodeBootstrapper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ export class NodeBootstrapper implements IBootstrapper {
1616
}
1717

1818
private isNode(): boolean {
19-
return !window && typeof global !== "undefined" && {}.toString.call(global) === '[object global]';
19+
return typeof window === 'undefined' && typeof global !== 'undefined' && {}.toString.call(global) === '[object global]';
2020
}
2121
}

src/bootstrap/WindowBootstrapper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Utils } from '../Utils';
88

99
export class WindowBootstrapper implements IBootstrapper {
1010
public register(): void {
11-
if (!window || !document) {
11+
if (typeof window === 'undefined' || typeof document === 'undefined') {
1212
return;
1313
}
1414

src/configuration/Configuration.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { IConfigurationSettings } from 'IConfigurationSettings';
22
import { ILastReferenceIdManager } from '../lastReferenceIdManager/ILastReferenceIdManager';
33
import { InMemoryLastReferenceIdManager } from '../lastReferenceIdManager/InMemoryLastReferenceIdManager';
4+
import { ConsoleLog } from '../logging/ConsoleLog';
45
import { ILog } from '../logging/ILog';
56
import { NullLog } from '../logging/NullLog';
67
import { IEventPlugin } from '../plugins/IEventPlugin';
@@ -124,10 +125,21 @@ export class Configuration implements IConfigurationSettings {
124125
}
125126
}
126127

128+
public setVersion(version:string): void {
129+
if (!!version && version.length > 0) {
130+
this.defaultData['@version'] = version;
131+
}
132+
}
133+
127134
public useReferenceIds(): void {
128135
this.addPlugin(new ReferenceIdPlugin());
129136
}
130137

138+
// TODO: Support a min log level.
139+
public useDebugLogger(): void {
140+
this.log = new ConsoleLog();
141+
}
142+
131143
private static _defaultSettings:IConfigurationSettings = null;
132144
public static get defaults() {
133145
if(Configuration._defaultSettings === null) {

0 commit comments

Comments
 (0)