Note(Kelosky): it seems from the log4js doc that you only get a single instance of log4js per category. To reconfigure, you should "shutdown" logger.

### Hierarchy

- Logger

## Index

### Constructors

- constructor

### Properties

- category
- initStatus
- mJsLogger
- DEFAULT_APP_NAME
- DEFAULT_CONSOLE_NAME
- DEFAULT_IMPERATIVE_NAME
- DEFAULT_VALID_LOG_LEVELS

### Accessors

- level
- logService

### Methods

- debug
- error
- fatal
- getCallerFileAndLineTag
- info
- logError
- simple
- trace
- warn
- fromLog4jsToWinston
- fromWinstonConfig
- getAppLogger
- getConsoleLogger
- getImperativeLogger
- getLoggerCategory
- initLogger
- isValidLevel
- setLogInMemory
- writeInMemoryMessages

## Constructors

### constructor

- new Logger(mJsLogger: log4js.Logger | winston.Logger | Console, category?: string): Logger

- - Defined in @zowe/imperative/src/logger/src/Logger.ts:266

  #### Parameters

  - ##### mJsLogger: log4js.Logger | winston.Logger | Console

  - ##### Optional category: string

  #### Returns Logger

## Properties

### Private Optional category

category: string

- Defined in @zowe/imperative/src/logger/src/Logger.ts:268

### Private initStatus

initStatus: boolean

- Defined in @zowe/imperative/src/logger/src/Logger.ts:266

This flag is being used to monitor the logger configure status.

### Private mJsLogger

mJsLogger: log4js.Logger | winston.Logger | Console

- Defined in @zowe/imperative/src/logger/src/Logger.ts:268

### Static Readonly DEFAULT_APP_NAME

DEFAULT_APP_NAME: "app" = "app"

- Defined in @zowe/imperative/src/logger/src/Logger.ts:33

### Static Readonly DEFAULT_CONSOLE_NAME

DEFAULT_CONSOLE_NAME: "console" = "console"

- Defined in @zowe/imperative/src/logger/src/Logger.ts:34

### Static Readonly DEFAULT_IMPERATIVE_NAME

DEFAULT_IMPERATIVE_NAME: "imperative" = "imperative"

- Defined in @zowe/imperative/src/logger/src/Logger.ts:32

### Static Readonly DEFAULT_VALID_LOG_LEVELS

DEFAULT_VALID_LOG_LEVELS: string[] = ["ALL", "TRACE", "DEBUG", "INFO", "WARN", "ERROR", "FATAL", "MARK", "OFF"]

- Defined in @zowe/imperative/src/logger/src/Logger.ts:35

## Accessors

### level

- get level(): string
- set level(level: string): void

- - Defined in @zowe/imperative/src/logger/src/Logger.ts:500

  Get current level setting

  #### Returns string

  - level of current log setting
- - Defined in @zowe/imperative/src/logger/src/Logger.ts:484

  Allow for programmatic adjustments to the logger

  #### Parameters

  - ##### level: string

    new level to set

  #### Returns void

  - level of current log setting

### Private logService

- get logService(): any
- set logService(service: log4js.Logger | winston.Logger | Console): void

- - Defined in @zowe/imperative/src/logger/src/Logger.ts:510

  Get underlying logger service

  This function also check to see if log4js is configured since the last time it was called. If yes, then update the logger with to leverage the new configuration.

  #### Returns any

- - Defined in @zowe/imperative/src/logger/src/Logger.ts:523

  Set underlying logger service

  This function also check to see if log4js is configured since the last time it was called. If yes, then update the logger with to leverage the new configuration.

  #### Parameters

  - ##### service: log4js.Logger | winston.Logger | Console

  #### Returns void

## Methods

### debug

- debug(message: string, ...args: any[]): string

- - Defined in @zowe/imperative/src/logger/src/Logger.ts:308

  Log a message at the "debug" level Example: 'Got cheese'

  #### Parameters

  - ##### message: string

    printf or mustache style template string, or a plain string message

  - ##### Rest ...args: any[]

    printf or mustache style args

  #### Returns string

### error

- error(message: string, ...args: any[]): string

- - Defined in @zowe/imperative/src/logger/src/Logger.ts:361

  Log a message at the "error" level Example: 'Cheese is too ripe!'

  #### Parameters

  - ##### message: string

    printf or mustache style template string, or a plain string message

  - ##### Rest ...args: any[]

    printf or mustache style args

  #### Returns string

### fatal

- fatal(message: string, ...args: any[]): string

- - Defined in @zowe/imperative/src/logger/src/Logger.ts:378

  Log a message at the "fatal" level Example: 'Cheese was breeding ground for listeria.'

  #### Parameters

  - ##### message: string

    printf or mustache style template string, or a plain string message

  - ##### Rest ...args: any[]

    printf or mustache style args

  #### Returns string

### Private getCallerFileAndLineTag

- getCallerFileAndLineTag(): string

- - Defined in @zowe/imperative/src/logger/src/Logger.ts:464

  Obtain .js file name and line number which issued the log message. NOTE(Kelosky): Consensus seems to be that this may produce a lot of overhead by creating an Error and obtaining stack information for EVERY log message that is issued.

  There are also packages available to obtain the appropriate line number.

  Perhaps when a package pops up that gives the appropriate .ts line number and file name, we'll remove usage of this method.

  #### Returns string

  - file and line number

### info

- info(message: string, ...args: any[]): string

- - Defined in @zowe/imperative/src/logger/src/Logger.ts:326

  Log a message at the "info" level Example: 'Cheese is Gouda'

  #### Parameters

  - ##### message: string

    printf or mustache style template string, or a plain string message

  - ##### Rest ...args: any[]

    printf or mustache style args

  #### Returns string

### logError

- logError(err: ImperativeError): void

- - Defined in @zowe/imperative/src/logger/src/Logger.ts:409

  Log an Imperative error, including any optional fields if present

  #### Parameters

  - ##### err: ImperativeError

    the error to log

  #### Returns void

### simple

- simple(message: string, ...args: any[]): string

- - Defined in @zowe/imperative/src/logger/src/Logger.ts:395

  Log a message without CallerFileAndLineTag Example: 'Cheese that is plain'

  #### Parameters

  - ##### message: string

    printf or mustache style template string, or a plain string message

  - ##### Rest ...args: any[]

    printf or mustache style args

  #### Returns string

### trace

- trace(message: string, ...args: any[]): string

- - Defined in @zowe/imperative/src/logger/src/Logger.ts:290

  Log a message at the "trace" level Example: 'Entering cheese testing'

  #### Parameters

  - ##### message: string

    printf style template string, or a plain string message

  - ##### Rest ...args: any[]

    printf style args

  #### Returns string

### warn

- warn(message: string, ...args: any[]): string

- - Defined in @zowe/imperative/src/logger/src/Logger.ts:344

  Log a message at the "warn" level Example: 'Cheese is quite smelly.'

  #### Parameters

  - ##### message: string

    printf or mustache style template string, or a plain string message

  - ##### Rest ...args: any[]

    printf or mustache style args

  #### Returns string

### Static fromLog4jsToWinston

- fromLog4jsToWinston(loggingConfig: IConfigLogging): Logger

- - Defined in @zowe/imperative/src/logger/src/Logger.ts:158

  Creates an instance of a Logger powered by Winston, based on a log4js config.

  #### Parameters

  - ##### loggingConfig: IConfigLogging

    The log4js configuration to use

  #### Returns Logger

  A new logger instance

### Static fromWinstonConfig

- fromWinstonConfig(config: winston.LoggerOptions, category?: string): Logger

- - Defined in @zowe/imperative/src/logger/src/Logger.ts:239

  Creates a new Logger instance from a given Winston configuration.

  #### Parameters

  - ##### config: winston.LoggerOptions

    The Winston logger configuration options.

  - ##### Optional category: string

  #### Returns Logger

  A new Logger instance.

### Static getAppLogger

- getAppLogger(): Logger

- - Defined in @zowe/imperative/src/logger/src/Logger.ts:66

  Get log4js instance directed at our app's category.

  #### Returns Logger

  - instance of logger set to our app's category

### Static getConsoleLogger

- getConsoleLogger(): Logger

- - Defined in @zowe/imperative/src/logger/src/Logger.ts:110

  Return an instance to the console logger which applies TextUtils invoked through this Logger class.

  Note(Kelosky): this is not the same as obtaining a new Console() directly, since we can make use of the internationalization and other routines within this Logger class via this implementation.

  #### Returns Logger

  - instance of logger set to our app's category

### Static getImperativeLogger

- getImperativeLogger(): Logger

- - Defined in @zowe/imperative/src/logger/src/Logger.ts:58

  Get accessibility to logging service to invoke log calls, e.g Logger.getLogger.info("important log info goes here");

  #### Returns Logger

  - instance of logger set to our app's category

### Static getLoggerCategory

- getLoggerCategory(category: string): Logger

- - Defined in @zowe/imperative/src/logger/src/Logger.ts:43

  Get accessibility to logging service to invoke log calls, e.g Logger.getLogger.info("important log info goes here");

  #### Parameters

  - ##### category: string

    category of logger to obtain

  #### Returns Logger

  - instance of logger set to our app's category

### Static initLogger

- initLogger(loggingConfig: IConfigLogging): Logger

- - Defined in @zowe/imperative/src/logger/src/Logger.ts:119

  Initializes a Logger powered by log4js, given a configuration.

  #### Parameters

  - ##### loggingConfig: IConfigLogging

    The log4js configuration to use

  #### Returns Logger

  A new logger instance

### Static isValidLevel

- isValidLevel(testLevel: string): boolean

- - Defined in @zowe/imperative/src/logger/src/Logger.ts:91

  Test if the input level is a valid value for Log4js.

  #### Parameters

  - ##### testLevel: string

    input level to be tested

  #### Returns boolean

  - status if the input level is valid

### Static setLogInMemory

- setLogInMemory(status: boolean, maxQueueSize?: number): void

- - Defined in @zowe/imperative/src/logger/src/Logger.ts:70

  #### Parameters

  - ##### status: boolean

  - ##### Optional maxQueueSize: number

  #### Returns void

### Static writeInMemoryMessages

- writeInMemoryMessages(file: string): void

- - Defined in @zowe/imperative/src/logger/src/Logger.ts:82

  Write all messages that was stored in memory to the input file.

  #### Parameters

  - ##### file: string

    destination file name

  #### Returns void

Generated using TypeDoc