11// Copyright (c) Microsoft Corporation. All rights reserved.
22// Licensed under the MIT License.
3+
34'use strict' ;
45
56import * as winston from 'winston' ;
@@ -8,7 +9,7 @@ import { CallInfo } from '../common/utils/decorators';
89import { getFormatter } from './formatters' ;
910import { LogLevel , resolveLevelName } from './levels' ;
1011import { configureLogger , createLogger , getPreDefinedConfiguration , logToAll } from './logger' ;
11- import { createTracingDecorator , LogInfo , TraceOptions , tracing as _tracing } from './trace' ;
12+ import { LogInfo , tracing as _tracing } from './trace' ;
1213import { getPythonOutputChannelTransport , IPythonOutputChannelContent } from './transports' ;
1314import { Arguments } from './util' ;
1415
@@ -44,7 +45,7 @@ function initialize() {
4445}
4546
4647// Set the logging level the extension logs at.
47- export function setLoggingLevel ( level : LogLevel | 'off' ) {
48+ export function setLoggingLevel ( level : LogLevel | 'off' ) : void {
4849 if ( level === 'off' ) {
4950 // For now we disable all logging. One alternative would be
5051 // to only disable logging to the output channel (by removing
@@ -59,7 +60,7 @@ export function setLoggingLevel(level: LogLevel | 'off') {
5960}
6061
6162// Register the output channel transport the logger will log into.
62- export function addOutputChannelLogging ( channel : IOutputChannel ) {
63+ export function addOutputChannelLogging ( channel : IOutputChannel ) : void {
6364 const formatter = getFormatter ( ) ;
6465 const transport = getPythonOutputChannelTransport ( channel , formatter ) ;
6566 _globalLoggerContent = transport ;
@@ -75,19 +76,19 @@ function log(logLevel: LogLevel, ...args: Arguments) {
7576 logToAll ( [ globalLogger ] , logLevel , args ) ;
7677}
7778
78- export function logVerbose ( ...args : any [ ] ) {
79+ export function logVerbose ( ...args : Arguments ) : void {
7980 log ( LogLevel . Info , ...args ) ;
8081}
8182
82- export function logError ( ...args : any [ ] ) {
83+ export function logError ( ...args : Arguments ) : void {
8384 log ( LogLevel . Error , ...args ) ;
8485}
8586
86- export function logInfo ( ...args : any [ ] ) {
87+ export function logInfo ( ...args : Arguments ) : void {
8788 log ( LogLevel . Info , ...args ) ;
8889}
8990
90- export function logWarning ( ...args : any [ ] ) {
91+ export function logWarning ( ...args : Arguments ) : void {
9192 log ( LogLevel . Warn , ...args ) ;
9293}
9394
@@ -96,24 +97,6 @@ export function tracing<T>(info: LogInfo, run: () => T, call?: CallInfo): T {
9697 return _tracing ( [ globalLogger ] , info , run , call ) ;
9798}
9899
99- export namespace traceDecorators {
100- const DEFAULT_OPTS : TraceOptions = TraceOptions . Arguments | TraceOptions . ReturnValue ;
101-
102- export function verbose ( message : string , opts : TraceOptions = DEFAULT_OPTS ) {
103- return createTracingDecorator ( [ globalLogger ] , { message, opts } ) ;
104- }
105- export function error ( message : string ) {
106- const opts = DEFAULT_OPTS ;
107- const level = LogLevel . Error ;
108- return createTracingDecorator ( [ globalLogger ] , { message, opts, level } ) ;
109- }
110- export function info ( message : string ) {
111- const opts = TraceOptions . None ;
112- return createTracingDecorator ( [ globalLogger ] , { message, opts } ) ;
113- }
114- export function warn ( message : string ) {
115- const opts = DEFAULT_OPTS ;
116- const level = LogLevel . Warn ;
117- return createTracingDecorator ( [ globalLogger ] , { message, opts, level } ) ;
118- }
100+ export function getGlobalLogger ( ) : winston . Logger {
101+ return globalLogger ;
119102}
0 commit comments