Commit d312c73d authored by Tobinsk's avatar Tobinsk
Browse files

Merge branch '11-new-winston-types' into 'master'

Update winston logger to new types. This woll break older dependencies

Closes #11

See merge request !11
parents 0655a02c 79ed349a
/// <reference types="winston" />
import { InterfaceKafkaGeoname } from './kafka-geoname';
import { LoggerInstance } from 'winston';
import { Logger as LoggerInstance } from 'winston';
import UriBuilder from './uri-builder';
import { InterfaceReporter } from './reporter';
export interface InterfaceCore {
......@@ -45,7 +44,7 @@ declare class Core {
* Get a logger instance
* @returns {winston.LoggerInstance}
*/
getLogger(): LoggerInstance;
getLogger(): any;
/**
* Get Config object
*/
......
/// <reference types="winston" />
import { LoggerInstance } from 'winston';
declare class Logger {
logDir: string;
private logger;
constructor(logDir: string);
getLogger(): LoggerInstance;
getLogger(): any;
private setup();
}
export default Logger;
......@@ -4,6 +4,7 @@ import { Transform } from 'stream';
* A type to for the PartitionCallback function
*/
export declare type PartitionCallback = (chunk: any) => number;
export declare type KeyCallback = (chunk: any) => number;
/**
* Prepare a value for kafka ProducerStream
*/
......@@ -16,6 +17,10 @@ declare class StreamProducerPreparer extends Transform {
* Partition
*/
private readonly partition;
/**
* Should we use a key or not
*/
private readonly key;
constructor(opts: any);
/**
* @inheritDoc
......
......@@ -11,8 +11,13 @@ class StreamProducerPreparer extends stream_1.Transform {
* Partition
*/
this.partition = -1;
/**
* Should we use a key or not
*/
this.key = false;
this.topic = opts.topic;
this.partition = opts.partition || -1;
this.key = opts.key || false;
}
/**
* @inheritDoc
......@@ -28,8 +33,11 @@ class StreamProducerPreparer extends stream_1.Transform {
value: chunk,
partition: typeof this.partition === 'function' ? this.partition(chunk) : this.partition,
};
if (typeof this.key === 'function') {
value.key = this.key(chunk);
}
callback(null, value);
}
}
exports.default = StreamProducerPreparer;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RyZWFtLXByb2R1Y2VyLXByZXBhcmVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOls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UFDLENBQUM7U0FDN0I7UUFDRCxRQUFRLENBQUMsSUFBSSxFQUFFLEtBQUssQ0FBQyxDQUFDO0lBQ3hCLENBQUM7Q0FDRjtBQUVELGtCQUFlLHNCQUFzQixDQUFDIn0=
\ No newline at end of file
......@@ -67,14 +67,6 @@
"resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-2.3.2.tgz",
"integrity": "sha512-vOVmaruQG5EatOU/jM6yU2uCp3Lz6mK1P5Ztu4iJjfM4SVHU9XYktPUQtKlIXuahqXHdEyUarMrBEwg5Cwu+bA=="
},
"@types/winston": {
"version": "2.3.9",
"resolved": "https://registry.npmjs.org/@types/winston/-/winston-2.3.9.tgz",
"integrity": "sha512-zzruYOEtNgfS3SBjcij1F6HlH6My5n8WrBNhP3fzaRM22ba70QBC2ATs18jGr88Fy43c0z8vFJv5wJankfxv2A==",
"requires": {
"@types/node": "*"
}
},
"ajv": {
"version": "5.5.2",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz",
......@@ -1094,6 +1086,7 @@
"version": "0.1.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"kind-of": "^3.0.2",
"longest": "^1.0.1",
......@@ -2276,7 +2269,8 @@
"longest": {
"version": "1.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"loose-envify": {
"version": "1.3.1",
......
......@@ -2,7 +2,7 @@ import nconf = require('nconf');
import sourcemap = require('source-map-support');
import logger, {default as Logger} from './logger';
import KafkaGeoname, {InterfaceKafkaGeoname} from './kafka-geoname';
import {LoggerInstance} from 'winston';
import {Logger as LoggerInstance} from 'winston';
import UriBuilder from './uri-builder';
import {InterfaceReporter, InterfaceReporterCollection, Reporter} from './reporter';
import fs = require('fs');
......
import * as fs from 'fs';
import { LoggerInstance } from 'winston';
import { Logger as LoggerInstance } from 'winston';
import winston = require('winston');
// get config file by convention
......
import yaml = require('js-yaml');
import fs = require('fs');
import {LoggerInstance} from "winston";
import {Logger as LoggerInstance} from "winston";
export interface InterfaceProvider {
slug: string
alias: string[],
slug: string;
alias: string[];
name: {
de: string,
fr: string,
it: string,
en: string,
}
};
description: {
de: string,
fr: string,
it: string,
en: string,
},
url_pattern: string
identifier_rule: string
};
url_pattern: string;
identifier_rule: string;
}
export default class UrlBuilder {
......@@ -64,4 +64,4 @@ export default class UrlBuilder {
// More configurable. We like to generate those links from a small interface. So we cann simply add and delete them
// we wana have a file from which we can load stuff into memory. We do not want to have DB overhead
// perhaps e need a rest interface. Otherwise we will have problem to "live" reload the config
\ No newline at end of file
// perhaps e need a rest interface. Otherwise we will have problem to "live" reload the config
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment