smartive / graylog-ts Goto Github PK
View Code? Open in Web Editor NEWProvides a class for logging with graylog. Written in TypeScript
License: MIT License
Provides a class for logging with graylog. Written in TypeScript
License: MIT License
Hi guys, I'm new to TypeScript and trying to use graylog-ts in a ng2 service (Ionic 2 project). I'm wondering if you could help me out? It might just be a configuration issue.
Here is my service:
import { Graylog } from 'graylog-ts';
import { Injectable } from '@angular/core';
@Injectable()
export class GraylogService {
constructor() {
console.log('Hello GraylogService Provider');
console.log(Graylog);
}
}
But once I plug it into my app providers:
import {
IonicApp,
IonicModule,
// ...
} from 'ionic-angular';
import {
NgModule,
// ...
} from '@angular/core';
import { GraylogService } from '../providers/graylog-service';
import { MyApp } from './app.component';
@NgModule({
bootstrap: [IonicApp],
declarations: [
// ...
],
entryComponents: [
// ...
],
imports: [
IonicModule.forRoot(MyApp),
],
providers: [
GraylogService,
// ...
],
})
export class AppModule {}
I get this weird error:
Uncaught TypeError: Object prototype may only be an Object or null: undefined
at create (<anonymous>)
at Function.Object.create (polyfills.js:2)
at inherits (inherits_browser.js:5)
at Object.<anonymous> (index.js:5)
at Object.<anonymous> (index.js:90)
at __webpack_require__ (bootstrap 56af062…:19)
at Object.<anonymous> (browser.js:7)
at Object.<anonymous> (browser.js:52)
at __webpack_require__ (bootstrap 56af062…:19)
at Object.<anonymous> (index.js:4)
Object.create @ polyfills.js:2
inherits @ inherits_browser.js:5
(anonymous) @ index.js:5
(anonymous) @ index.js:90
__webpack_require__ @ bootstrap 56af062…:19
(anonymous) @ browser.js:7
(anonymous) @ browser.js:52
__webpack_require__ @ bootstrap 56af062…:19
(anonymous) @ index.js:4
__webpack_require__ @ bootstrap 56af062…:19
(anonymous) @ graylog.js:2
(anonymous) @ graylog.js:305
__webpack_require__ @ bootstrap 56af062…:19
(anonymous) @ Graylog.js:3
__webpack_require__ @ bootstrap 56af062…:19
(anonymous) @ index.js:5
__webpack_require__ @ bootstrap 56af062…:19
(anonymous) @ messages.js:13
__webpack_require__ @ bootstrap 56af062…:19
(anonymous) @ main.js:104103
__webpack_require__ @ bootstrap 56af062…:19
(anonymous) @ main.js:165011
__webpack_require__ @ bootstrap 56af062…:19
(anonymous) @ bootstrap 56af062…:65
(anonymous) @ bootstrap 56af062…:65
I've seen errors like this on platforms where core nodejs modules aren't supported and need to be shimmed with browser counterparts. Could this be the case?
I see that node-graylog2 is using a few core node modules: https://github.com/Wizcorp/node-graylog2/blob/master/graylog.js#L1-L6.
Hi,
I try to use this to log in my server Graylog from an Ionic2/Agnular2 app on Android.
But i have this error on load
Uncaught Error: Cannot find module "dgram"
providers/graylog-service.js
import { Graylog, GraylogConfig } from 'graylog-ts';
import { Injectable } from '@angular/core';
@Injectable()
export class GraylogService {
private graylog: Graylog;
constructor() {
let servers: any = [{ host: "graylog.example.com", port: 9022 }];
this.graylog = new Graylog({ servers: servers, hostname: "graylog.example.com" });
}
}
I have do this
npm install dgram --save
but the problem persist
An idea ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.