npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mattermost/react-native-turbo-log

v0.4.0

Published

test

Downloads

963

Readme

@mattermost/react-native-turbo-log

File logger for React Native (TurboModules) with configurable rolling policy

Installation

npm install @mattermost/react-native-turbo-log
npx pod-install

Usage

import TurboLogger from "@mattermost/react-native-turbo-log";

await TurboLogger.configure();

// ...

After configuring TurboLogger, your app will store logs in the filesystem. If not specified, all your console calls for debug, log, info, warn and error will be captured by TurboLogger and they'll also get writen to the log files.

You can configure TurboLogger to customize the rolling policy, the interception of console calls or to enable / disable logging to the filesystem.

API

TurboLogger.configure(options?: ConfigureOptions) => Promise

Initialize the TurboLogger with the specified options. Once the configure promise is resolved, all console calls are captured and writen to the log file unless specified otherwise. To ensure that no logs are missing, it is good practice to await this call at the launch of your app.

| Option | Description | Default | | --- | --- | --- | | logLevel | Minimum log level for file output (it won't affect console output) | LogLevel.Debug | | captureConsole | If true, all console calls are automatically captured and written to a log file | true | | dailyRolling | If true, a new log file is created every day | false | | maximumFileSize | A new log file is created when current log file exceeds the given size in bytes. Set it to 0 to disable | 1024 * 1024 (1MB) | | maximumNumberOfFiles | Maximum number of log files to keep. When a new log file is created, if the total number of files exceeds this limit, the oldest file is deleted. 0 to disable | 5 | | logsDirectory | Absolute path of directory where log files are stored. If not defined, log files are stored in the cache directory of the app | undefined | | logToFile | If true, log files are created and written to the filesystem. It can also be changed by calling the setLogToConsole method | true |

TurboLogger.deleteLogs(): Promise

Remove all your app log files from the filesystem.

TurboLogger.getLogPaths(): Promise<string[]>

Return the absolute path of all the log files.

TurboLogger.setLogToFile(enabled: boolean)

Enable or disable logging messages to files

Logging without console

If you don't want to use console calls for file logging, you can instead access TurboLogger methods to write messages to the log files, this approach allows you to log only the relevant messages for your app while discarding console calls made by any third-party library.

TurboLogger.debug(...args: any)

Shortcut for TurboLogger.log(LogLevel.Debug, ...args).

TurboLogger.info(...args: any)

Shortcut for TurboLogger.log(LogLevel.Info, ...args).

TurboLogger.warn(...args: any)

Shortcut for TurboLogger.log(LogLevel.Warning, ...args).

TurboLogger.error(...args: any)

Shortcut for TurboLogger.log(LogLevel.Error, ...args).

TurboLogger.log(level: LogLevel, ...args: any)

Append the log message using the same formatting as console with the specified level.

Important: log formatting does not support string substitution

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow and remember to follow the Code Of Conduct.

License

MIT License


Made with create-react-native-library