@firebase/logger

  • Version 0.4.1
  • Published
  • 85.9 kB
  • 1 dependency
  • Apache-2.0 license

Install

npm i @firebase/logger
yarn add @firebase/logger
pnpm add @firebase/logger

Overview

A logger package for use in the Firebase JS SDK

Index

Functions

function setLogLevel

setLogLevel: (level: LogLevelString | LogLevel) => void;

    function setUserLogHandler

    setUserLogHandler: (
    logCallback: LogCallback | null,
    options?: LogOptions
    ) => void;

      Classes

      class Logger

      class Logger {}

        constructor

        constructor(name: string);
        • Gives you an instance of a Logger to capture messages according to Firebase's logging scheme.

          Parameter name

          The name that the logs will be associated with

        property logHandler

        logHandler: LogHandler;

          property logLevel

          logLevel: LogLevel;

            property name

            name: string;

              property userLogHandler

              userLogHandler: LogHandler;

                method debug

                debug: (...args: unknown[]) => void;
                • The functions below are all based on the console interface

                method error

                error: (...args: unknown[]) => void;

                  method info

                  info: (...args: unknown[]) => void;

                    method log

                    log: (...args: unknown[]) => void;

                      method setLogLevel

                      setLogLevel: (val: LogLevel | LogLevelString) => void;

                        method warn

                        warn: (...args: unknown[]) => void;

                          Interfaces

                          interface LogOptions

                          interface LogOptions {}

                            property level

                            level: LogLevelString;

                              Enums

                              enum LogLevel

                              enum LogLevel {
                              DEBUG = 0,
                              VERBOSE = 1,
                              INFO = 2,
                              WARN = 3,
                              ERROR = 4,
                              SILENT = 5,
                              }
                              • The JS SDK supports 5 log levels and also allows a user the ability to silence the logs altogether.

                                The order is a follows: DEBUG < VERBOSE < INFO < WARN < ERROR

                                All of the log types above the current log level will be captured (i.e. if you set the log level to INFO, errors will still be logged, but DEBUG and VERBOSE logs will not)

                              member DEBUG

                              DEBUG = 0

                                member ERROR

                                ERROR = 4

                                  member INFO

                                  INFO = 2

                                    member SILENT

                                    SILENT = 5

                                      member VERBOSE

                                      VERBOSE = 1

                                        member WARN

                                        WARN = 3

                                          Type Aliases

                                          type LogCallback

                                          type LogCallback = (callbackParams: LogCallbackParams) => void;

                                            type LogHandler

                                            type LogHandler = (
                                            loggerInstance: Logger,
                                            logType: LogLevel,
                                            ...args: unknown[]
                                            ) => void;
                                            • We allow users the ability to pass their own log handler. We will pass the type of log, the current log level, and any other arguments passed (i.e. the messages that the user wants to log) to this function.

                                            type LogLevelString

                                            type LogLevelString = 'debug' | 'verbose' | 'info' | 'warn' | 'error' | 'silent';
                                            • Copyright 2017 Google LLC

                                              Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

                                              http://www.apache.org/licenses/LICENSE-2.0

                                              Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

                                            Package Files (2)

                                            Dependencies (1)

                                            Dev Dependencies (3)

                                            Peer Dependencies (0)

                                            No peer dependencies.

                                            Badge

                                            To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                            You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@firebase/logger.

                                            • Markdown
                                              [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@firebase/logger)
                                            • HTML
                                              <a href="https://www.jsdocs.io/package/@firebase/logger"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>