Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Commit

Permalink
refactor: tsconfig from core package (#35)
Browse files Browse the repository at this point in the history
refactor: tsconfig.ts from core package
  • Loading branch information
fabiogomessilva authored and kjin committed Jun 12, 2018
1 parent 51f06fb commit d6f2fe3
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 24 deletions.
18 changes: 8 additions & 10 deletions packages/opencensus-core/src/common/console-logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,15 @@
*/

import * as util from 'util';

import * as types from './types';

const logDriver = require('log-driver');


/**
* This class implements a console logger.
*/
export class ConsoleLogger implements types.Logger {
// tslint:disable:no-any
private logger: any;
private logger: typeof logDriver;
static LEVELS = ['silent', 'error', 'warn', 'info', 'debug', 'silly'];
level: string;

Expand Down Expand Up @@ -61,7 +58,7 @@ export class ConsoleLogger implements types.Logger {
* @param message menssage erro to log in console
* @param args arguments to log in console
*/
// tslint:disable:no-any
// tslint:disable-next-line:no-any
error(message: any, ...args: any[]): void {
this.logger.error(util.format(message, ...args));
}
Expand All @@ -71,7 +68,7 @@ export class ConsoleLogger implements types.Logger {
* @param message menssage warning to log in console
* @param args arguments to log in console
*/
// tslint:disable:no-any
// tslint:disable-next-line:no-any
warn(message: any, ...args: any[]): void {
this.logger.warn(util.format(message, ...args));
}
Expand All @@ -81,7 +78,7 @@ export class ConsoleLogger implements types.Logger {
* @param message menssage info to log in console
* @param args arguments to log in console
*/
// tslint:disable:no-any
// tslint:disable-next-line:no-any
info(message: any, ...args: any[]): void {
this.logger.info(util.format(message, ...args));
}
Expand All @@ -91,7 +88,7 @@ export class ConsoleLogger implements types.Logger {
* @param message menssage debug to log in console
* @param args arguments to log in console
*/
// tslint:disable:no-any
// tslint:disable-next-line:no-any
debug(message: any, ...args: any[]): void {
this.logger.debug(util.format(message, ...args));
}
Expand All @@ -101,7 +98,7 @@ export class ConsoleLogger implements types.Logger {
* @param message menssage silly to log in console
* @param args arguments to log in console
*/
// tslint:disable:no-any
// tslint:disable-next-line:no-any
silly(message: any, ...args: any[]): void {
this.logger.silly(util.format(message, ...args));
}
Expand All @@ -115,7 +112,8 @@ export class ConsoleLogger implements types.Logger {
* Function logger exported to others classes.
* @param options A logger options or strig to logger in console
*/
const logger = (options?: types.LoggerOptions|string|number) => {
// tslint:disable-next-line:no-any
const logger: any = (options?: types.LoggerOptions|string|number) => {
const aLogger = new ConsoleLogger(options);
logger['logger'] = aLogger;
return aLogger;
Expand Down
2 changes: 1 addition & 1 deletion packages/opencensus-core/test/test-console-logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ let consoleTxt = '';

describe('ConsoleLogger', () => {
const intercept = require('intercept-stdout');
const unhookIntercept = intercept((txt) => {
const unhookIntercept = intercept((txt: string) => {
consoleTxt = txt;
return txt;
});
Expand Down
3 changes: 2 additions & 1 deletion packages/opencensus-core/test/test-root-span.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import * as mocha from 'mocha';
import {RootSpan} from '../src/trace/model/root-span';
import {Span} from '../src/trace/model/span';
import {Tracer} from '../src/trace/model/tracer';
import * as types from '../src/trace/model/types';
import {Annotation, Attributes, Link, MessageEvent, TraceOptions} from '../src/trace/model/types';

const tracer = new Tracer();
Expand Down Expand Up @@ -92,7 +93,7 @@ describe('RootSpan', () => {
* Should create and start a new span instance
*/
describe('startSpan()', () => {
let root, span;
let root: types.RootSpan, span: types.Span;

before(() => {
root = new RootSpan(tracer);
Expand Down
3 changes: 2 additions & 1 deletion packages/opencensus-core/test/test-span.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import * as mocha from 'mocha';
import {RootSpan} from '../src/trace/model/root-span';
import {Span} from '../src/trace/model/span';
import {Tracer} from '../src/trace/model/tracer';
import * as types from '../src/trace/model/types';
import {Annotation, Attributes, Link, MessageEvent} from '../src/trace/model/types';


Expand Down Expand Up @@ -74,7 +75,7 @@ describe('Span', () => {
* clock instance created
*/
describe('get time properties before start()', () => {
let span;
let span: types.Span;
before(() => {
const rootSpan = new RootSpan(tracer);
rootSpan.start();
Expand Down
8 changes: 4 additions & 4 deletions packages/opencensus-core/test/test-tracer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe('Tracer', () => {

/** Should return a started tracer instance */
describe('start()', () => {
let tracerStarted;
let tracerStarted: types.Tracer;
before(() => {
const tracer = new Tracer();
assert.strictEqual(tracer.active, false);
Expand All @@ -82,7 +82,7 @@ describe('Tracer', () => {

/** Should return an OnEndSpanEventListener list */
describe('registerSpanEventListener() / get eventListeners()', () => {
let tracer, onEndSpan;
let tracer: types.Tracer, onEndSpan: OnEndSpanClass;
before(() => {
tracer = new Tracer();
onEndSpan = new OnEndSpanClass();
Expand Down Expand Up @@ -117,7 +117,7 @@ describe('Tracer', () => {

/** Should create and start a new RootSpan instance */
describe('startRootSpan()', () => {
let rootSpanLocal;
let rootSpanLocal: types.RootSpan;
before(() => {
const tracer = new Tracer();
tracer.start(defaultConfig);
Expand All @@ -135,7 +135,7 @@ describe('Tracer', () => {

/** Should create and start a new RootSpan instance with options */
describe('startRootSpan() with options', () => {
let rootSpanLocal;
let rootSpanLocal: types.RootSpan;
before(() => {
const tracer = new Tracer();
tracer.start(defaultConfig);
Expand Down
8 changes: 1 addition & 7 deletions packages/opencensus-core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,10 @@
"compilerOptions": {
"rootDir": ".",
"outDir": "build",
"allowUnreachableCode": true,
"noUnusedParameters": false,
"noImplicitAny": false,
"noImplicitThis": false,
"noEmitOnError": false,
"pretty": true,
"strict": false,
"module": "commonjs",
"target": "es6",
"sourceMap": false
"strictNullChecks": false
},
"include": [
"src/**/*.ts",
Expand Down

0 comments on commit d6f2fe3

Please sign in to comment.