{"id":13893824,"url":"https://github.com/mowispace/react-native-logs","last_synced_at":"2025-05-15T16:02:28.683Z","repository":{"id":41293714,"uuid":"194547465","full_name":"mowispace/react-native-logs","owner":"mowispace","description":"Performance-aware simple logger for React-Native and Expo with namespaces, custom levels and custom transports (colored console, file writing, etc.)","archived":false,"fork":false,"pushed_at":"2024-11-18T23:50:56.000Z","size":677,"stargazers_count":498,"open_issues_count":10,"forks_count":35,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-10T06:40:35.204Z","etag":null,"topics":["android","color","custom","debug","debugging","expo","file","ios","javascript","log","logger","logging","logging-library","logs","react-native"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mowispace.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-30T18:19:46.000Z","updated_at":"2025-04-10T03:02:36.000Z","dependencies_parsed_at":"2024-01-16T21:05:40.404Z","dependency_job_id":"259b4fee-aec8-4c4d-992b-700551079cc2","html_url":"https://github.com/mowispace/react-native-logs","commit_stats":{"total_commits":80,"total_committers":11,"mean_commits":"7.2727272727272725","dds":0.3375,"last_synced_commit":"92fe64fb0f306cdb145671419d27e1e3e4da0858"},"previous_names":["mowispace/react-native-logs","onubo/react-native-logs"],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mowispace%2Freact-native-logs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mowispace%2Freact-native-logs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mowispace%2Freact-native-logs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mowispace%2Freact-native-logs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mowispace","download_url":"https://codeload.github.com/mowispace/react-native-logs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254374388,"owners_count":22060609,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","color","custom","debug","debugging","expo","file","ios","javascript","log","logger","logging","logging-library","logs","react-native"],"created_at":"2024-08-06T18:01:17.919Z","updated_at":"2025-05-15T16:02:28.628Z","avatar_url":"https://github.com/mowispace.png","language":"TypeScript","readme":"![npm](https://img.shields.io/npm/v/react-native-logs.svg)\n![GitHub](https://img.shields.io/github/license/onubo/react-native-logs.svg)\n[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/onubo/react-native-logs/issues)\n\n# react-native-logs\n\nPerformance-aware simple logger for React-Native, Expo (managed and bare) and react-native-web with custom levels and transports (colored console,\nfile writing, etc.).\n\nEach level has its severity: a number that represents its importance in\nascending order from the least important to the most important. Eg. _debug:0, info:1, warn:2,\nerror:3_.\n\nBy config the logger with a minium severity level, you will see only the logs that have it\nhighest. Then logs will be managed by transport: the function that will display/save/send log\nmessages.\n\nIt is also possible to extend the logger to create namespaced logs. In this way you will be able to see the log messages only for one or some parts of the code of your choice\n\n**Demo console transport with custom colored levels and namespaces:**\n![console log demo](https://raw.githubusercontent.com/onubo/react-native-logs/master/demo/demo-react-native-logs.png)\n\n## Why another logging library?\n\nAfter trying the most known logging libraries, like winston and bunyan, we found that for\nreact-native we needed something simpler, but still flexible, and without dependencies on nodejs. Comments and suggestions are welcome.\n\n## Installation\n\n```sh\nnpm install --save react-native-logs\n```\n\nOR\n\n```sh\nyarn add react-native-logs\n```\n\nOR\n\n```sh\nexpo install react-native-logs\n```\n\n## Quick Start\n\n```javascript\nimport { logger } from \"react-native-logs\";\n\nvar log = logger.createLogger();\n\nlog.debug(\"This is a Debug log\");\nlog.info(\"This is an Info log\");\nlog.warn(\"This is a Warning log\");\nlog.error(\"This is an Error log\");\n```\n\nBy default the `createLogger()` method (called without arguments) will create a simple console logger with debug, info, warn\nand error levels.\n\n## Configuration\n\nYou can customize the logger by passing a config object to the `createLogger` method (see example\nbelow). All params are optional and will take default values if no corresponding argument is passed.\n\n| Parameter         | Type                   | Description                                                                            | Default                                 |\n| ----------------- | ---------------------- | -------------------------------------------------------------------------------------- | --------------------------------------- |\n| severity          | string                 | Init logs severity (least important level you want to see)                             | `debug` (or the first custom level)     |\n| transport         | function or [function] | The transport function/s for logs (see below for presets)                              | The preset transport `consoleTransport` |\n| transportOptions  | Object                 | Set custom options for transports                                                      | `null`                                  |\n| levels            | Object                 | Set custom log levels: {name:power}                                                    | `false`                                 |\n| async             | boolean                | Set to true for async logs (to improve app performance)                                | `true`                                  |\n| asyncFunc         | function               | Set a cutom async function `(cb: Function) =\u003e {return cb()}`                           | `setTimeout`                            |\n| stringifyFunc     | function               | Set a cutom stringify function `(msg: any) =\u003e string`                                  | a customized `JSON.stringify`           |\n| formatFunc        | function               | Set a custom format function `(level: string, extension?: string, msg: any) =\u003e string` | default string format function          |\n| dateFormat        | string or function     | `time`, `local`, `utc`, `iso` or `(date: Date) =\u003e string`                              | `time`                                  |\n| printLevel        | boolean                | Choose whether to print the log level                                                  | `true`                                  |\n| printDate         | boolean                | Choose whether to print the log date/time                                              | `true`                                  |\n| fixedExtLvlLength | boolean                | Ensure consistent character count alignment when printing extensions and levels        | `false`                                 |\n| enabled           | boolean                | Enable or disable logging                                                              | `true`                                  |\n| enabledExtensions | string[]               | Enable only certain namespaces                                                         | `null`                                  |\n\n#### Example with common configuration\n\n```javascript\nimport { logger, consoleTransport } from \"react-native-logs\";\n\nvar log = logger.createLogger({\n  levels: {\n    debug: 0,\n    info: 1,\n    warn: 2,\n    error: 3,\n  },\n  severity: \"debug\",\n  transport: consoleTransport,\n  transportOptions: {\n    colors: {\n      info: \"blueBright\",\n      warn: \"yellowBright\",\n      error: \"redBright\",\n    },\n  },\n  async: true,\n  dateFormat: \"time\",\n  printLevel: true,\n  printDate: true,\n  fixedExtLvlLength: false,\n  enabled: true,\n});\n\nlog.debug(\"Debug message\");\nlog.info({ message: \"hi!\" });\n```\n\n### Custom levels\n\nLog levels have this format: `{ name : severity }` and you can create your personalized list, Eg:\n\n```javascript\nimport { logger } from \"react-native-logs\";\n\nvar log = logger.createLogger({\n  levels: {\n    trace: 0,\n    info: 1,\n    silly: 2,\n    error: 3,\n    mad: 4,\n  },\n});\n\nlog.silly(\"Silly message\");\n```\n\n### Levels typing\n\n(available only if you use typescript)\n\nThe package will take the types of log levels directly from the configuration, or the default ones if not specified.\n\n```typescript\nimport { logger } from \"react-native-logs\";\n\nvar log = logger.createLogger({\n  levels: {\n    trace: 0,\n    info: 1,\n    error: 2,\n  },\n});\n\nlog.trace(\"message\"); // correct log call\n\nlog.silly(\"message\"); // typescript error, \"silly\" method does not exist\n```\n\n### Custom transport\n\nYou can write your own transport to send logs to a cloud service, save it in to a database, or do\nwhatever you want. The following parameters are received by the function:\n\n- `msg: any`: the message formatted by logger \"[time] | [namespace] | [level] | [msg]\"\n- `rawMsg: any`: the message (or array of messages) in its original form\n- `level: { severity: number; text: string }`: the log level\n- `extension?: string | null`: its namespace if it is an extended log\n- `options?: any`: the transportOptions object\n\nYou can define your custom transport as follow (example in typescript):\n\n```javascript\nimport { logger, transportFunctionType } from \"react-native-logs\";\n\nconst customTransport: transportFunctionType\u003c{ myCustomOption: string }\u003e = (\n  props\n) =\u003e {\n  // Do here whatever you want with the log message\n  // You can use any options setted in config.transportOptions\n  // Eg. a console log: console.log(props.level.text, props.msg)\n};\n\nvar log = logger.createLogger({\n  transport: customTransport,\n  transportOptions: {\n    myCustomOption: \"option\",\n  },\n});\n\nlog.debug(\"Debug message\");\n```\n\n### Transport Options\n\nBy setting the `transportOptions` parameter you can insert the options that will be passed to\ntransports. For some transports these may be mandatory, as in the case of the `FS` option for the `fileAsyncTransport`\n(see preset transports list for details).\n\n```javascript\nimport { logger, fileAsyncTransport } from \"react-native-logs\";\nimport RNFS from \"react-native-fs\";\n\nvar log = logger.createLogger({\n  transport: fileAsyncTransport,\n  transportOptions: {\n    FS: RNFS,\n    fileName: `log.txt`,\n  },\n});\n\nlog.debug(\"Debug message\");\n```\n\n### Multiple Arguments\n\nLog messages can be concatenated by adding arguments to the log function:\n\n```javascript\nvar errorObject = {\n  staus: 404,\n  message: \"Undefined Error\",\n};\nlog.error(\"New error occured\", errorObject);\n```\n\n### Preset transports\n\nreact-native-logs includes some preset transports. You can import the one of your choice:\n`import { logger, \u003ctransportName\u003e } from 'react-native-logs';`\n\n#### Example\n\n```javascript\nimport { logger, mapConsoleTransport } from \"react-native-logs\";\n\nvar log = logger.createLogger({\n  transport: mapConsoleTransport,\n});\n\nlog.debug(\"Debug message\");\n```\n\n## List of included preset transports\n\n### **consoleTransport**\n\nPrint the logs with a formatted `console.log` output.\n\nIf you need a different console or method to be used instead of `console.log` you can set the `consoleFunc` option with your custom console.\n\n| name            | type           | description                                                              | default |\n| --------------- | -------------- | ------------------------------------------------------------------------ | ------- |\n| colors          | object         | If setted you can choose the log colors, defined by level: {level:color} | `null`  |\n| extensionColors | object         | If setted you can choose the extension label colors: {extension:color}   | `null`  |\n| consoleFunc     | (msg:any)=\u003eany | If setted you can choose the console object                              | `null`  |\n\n#### Available colors\n\n| name          | ansi code | note                  |\n| ------------- | --------- | --------------------- |\n| default       | null      | default console color |\n| black         | 30        |\n| red           | 31        |\n| green         | 32        |\n| yellow        | 33        |\n| blue          | 34        |\n| magenta       | 35        |\n| cyan          | 36        |\n| white         | 37        |\n| grey          | 90        |\n| redBright     | 91        |\n| greenBright   | 92        |\n| yellowBright  | 93        |\n| blueBright    | 94        |\n| magentaBright | 95        |\n| cyanBright    | 96        |\n| whiteBright   | 97        |\n\n#### Example\n\n```javascript\nimport { logger, consoleTransport } from \"react-native-logs\";\n\nvar log = logger.createLogger({\n  levels: {\n    debug: 0,\n    info: 1,\n    warn: 2,\n    error: 3,\n  },\n  transport: consoleTransport,\n  transportOptions: {\n    colors: {\n      info: \"blueBright\",\n      warn: \"yellowBright\",\n      error: \"redBright\",\n    },\n    extensionColors: {\n      root: \"magenta\",\n      home: \"green\",\n    },\n  },\n});\n\nvar rootLog = log.extend(\"root\");\nvar homeLog = log.extend(\"home\");\n\nrootLog.info(\"Magenta Extension and bright blue message\");\nhomeLog.error(\"Green Extension and bright red message\");\n```\n\n### **mapConsoleTransport**\n\nPrint the logs with a selected `console` method (`console.log`, `console.warn`, `console.error`, etc.).\n\n| name      | type   | description                                        | default |\n| --------- | ------ | -------------------------------------------------- | ------- |\n| mapLevels | object | Select the console method by level: {level:method} | `null`  |\n\nIf mapLevels is not setted, the transport will try to map the console methods with the level name.\n\n#### Example\n\n```javascript\nimport { logger, mapConsoleTransport } from \"react-native-logs\";\n\nvar log = logger.createLogger({\n  levels: {\n    debug: 0,\n    info: 1,\n    warn: 2,\n    err: 3,\n  },\n  transport: mapConsoleTransport,\n  transportOptions: {\n    mapLevels: {\n      debug: \"log\",\n      info: \"info\",\n      warn: \"warn\",\n      err: \"error\",\n    },\n  },\n});\n\nlog.debug(\"Print this with console.log\");\nlog.err(\"Print this with console.error\");\n```\n\n### **fileAsyncTransport**\n\nThis transport requires the installation of `react-native-fs`([install tutorial here](https://github.com/itinance/react-native-fs)) or `expo-file-system`, and allows you to save the\nlogs on the `\u003cfilePath\u003e/\u003cfileName\u003e.txt` file.\n\nIf you want a new file to be created every day you can use `{date-today}` in the fileName: `app_logs_{date-today}.log` -\u003e `app_logs_D-M-YYYY.log`.\n\n#### Accepted Options:\n\n| name             | type            | description                                                                       | default                                                             |\n| ---------------- | --------------- | --------------------------------------------------------------------------------- | ------------------------------------------------------------------- |\n| FS               | Object          | MANDATORY, filesystem instance for the transport (RNFS or expo FileSystem)        | `null`                                                              |\n| fileName         | string          | set logs file name (insert `{date-today}` for current date)                       |\n| fileNameDateType | `eu`,`us`,`iso` | `{date-today}` date type `eu` \"DD-MM-YYYY\", `us` \"MM-DD-YYYY\", `iso` \"YYYY-MM-DD\" | `eu`                                                                |\n| filePath         | string          | set logs file path                                                                | `RNFS.DocumentDirectoryPath` or expo `FileSystem.documentDirectory` |\n\n#### Example:\n\n```javascript\nimport { logger, fileAsyncTransport } from \"react-native-logs\";\nimport RNFS from \"react-native-fs\";\n/* EXPO:\n * import * as FileSystem from 'expo-file-system';\n */\n\nlet today = new Date();\nlet date = today.getDate();\nlet month = today.getMonth() + 1;\nlet year = today.getFullYear();\n\nvar log = logger.createLogger({\n  severity: \"debug\",\n  transport: fileAsyncTransport,\n  transportOptions: {\n    FS: RNFS,\n    /* EXPO:\n     * FS: FileSystem,\n     */\n    fileName: `logs_{date-today}`, // Create a new file every day\n  },\n});\n\nlog.info(\"Print this string to a file\");\n```\n\nNOTE: Following\n[this example](https://github.com/itinance/react-native-fs#file-upload-android-and-ios-only) it will\nbe possible to upload the file to your remote server\n\n### **sentryTransport**\n\nSend logs to [Sentry](https://github.com/getsentry/sentry-react-native). The transport allows setting which log levels are errors, so that all others are treated as breadcrumbs, meaning log messages related to the next error that will occur. Otherwise, if not set, all messages will be treated as errors.\n\n#### Accepted Options:\n\n| name        | type                    | description                                                                      | default |\n| ----------- | ----------------------- | -------------------------------------------------------------------------------- | ------- |\n| SENTRY      | Object                  | MANDATORY, Sentry instance for the transport                                     | `null`  |\n| errorLevels | Array\u003cstring\u003e or string | Specify which log levels are errors (If null, all msg will be treated as errors) | `null`  |\n\n#### Example:\n\n```javascript\nimport { logger, sentryTransport } from \"react-native-logs\";\nimport * as Sentry from \"@sentry/react-native\";\n\n/*\n * Configure sentry\n */\n\nvar log = logger.createLogger({\n  severity: \"debug\",\n  transport: sentryTransport,\n  transportOptions: {\n    SENTRY: Sentry,\n    errorLevels: \"error\",\n  },\n});\n\nlog.warn(\"Send this log to Sentry as breadcumb\");\nlog.error(\"Send this log to Sentry as error\");\n```\n\n## Extensions (Namespaced loggers)\n\nTo enable logging only for certain parts of the app, you can extend the logger to different namespaces using the \"extend\" method. You can enable these extensions from the configuration (`config.enabledExtensions`) or by using the `enable`/`disable` methods.\n\n#### Example:\n\n```javascript\nimport { logger, consoleTransport } from \"react-native-logs\";\n\nvar log = logger.createLogger({\n  transport: consoleTransport,\n  enabledExtensions: [\"ROOT\", \"HOME\"],\n});\n\nvar rootLog = log.extend(\"ROOT\");\nvar homeLog = log.extend(\"HOME\");\nvar profileLog = log.extend(\"PROFILE\");\n\nlog.debug(\"print this\"); // this will print \"\u003ctime\u003e | DEBUG | print this\"\nrootLog.debug(\"print this\"); // this will print \"\u003ctime\u003e | ROOT | DEBUG | print this\"\nhomeLog.debug(\"print this\"); // this will print \"\u003ctime\u003e | HOME | DEBUG | print this\"\nprofileLog.debug(\"not print this\"); // this extension is not enabled\n```\n\n## Methods\n\n#### enable/disable\n\nDynamically enable/disable loggers and extensions, if it is called without parameters then it will disable/enable the whole logger:\n\n```javascript\nimport { logger, consoleTransport } from \"react-native-logs\";\n\nvar log = logger.createLogger({\n  transport: consoleTransport,\n  enabledExtensions: [\"ROOT\", \"HOME\"],\n});\n\nvar rootLog = log.extend(\"ROOT\");\nvar homeLog = log.extend(\"HOME\");\n\nlog.info(\"print this\"); // this will print \"\u003ctime\u003e | ROOT | INFO | print this\"\nhomeLog.info(\"print this\"); // extension is enabled\n\nlog.disable(\"HOME\");\n\nhomeLog.info(\"not print this\"); // extension is not enabled\nrootLog.info(\"print this\"); // extension is enabled\n\nlog.disable();\n\nhomeLog.info(\"not print this\"); // logger is not enabled\nrootLog.info(\"not print this\"); // logger is not enabled\nlog.info(\"not print this\"); // logger is not enabled\n```\n\n#### getExtensions\n\nGet an array of currently created extensions.\n\n#### setSeverity\n\nYou can set the severity level by passing the name(string) of the least important level you want to\nsee. This method will overwrite any `config.severity` option set in logger creation.\n\n```javascript\nvar log = logger.createLogger();\n\nlog.setSeverity(\"info\");\nlog.debug(\"This log will not be printed\");\nlog.info(\"This log will be printed correctly\");\nlog.error(\"This log will be printed correctly\");\n```\n\n#### getSeverity\n\nYou can get the current severity level setted.\n\n```javascript\nvar log = logger.createLogger();\n\nvar defaultseverity = log.getSeverity(); // severity = debug\nlog.setSeverity(\"info\");\nvar severity = log.getSeverity(); // severity = info\nlog.setSeverity(\"error\");\nvar newseverity = log.getSeverity(); // newseverity = error\n```\n\n#### patchConsole\n\n(Experimental)\n\nWith this method you are going to overwrite the default console, which is useful in case you are installing this package in an existing software where you use the default console.\n\nAny levels you specify in configuration, if they exist, will be mapped to the console methods (console.log, console.info, console.error, etc...).\n\nIf you do not specify a `log` level in configuration then your first level will be mapped to it.\n\nAll calls to `console.*` will then be handled by your react-native-logs logger and then you can manage their visibility via severity, or change their transports.\n\nThis method may have undesirable effects, so I recommend using it only if necessary.\n\n```javascript\nimport { logger, consoleTransport } from \"react-native-logs\";\n\nconst config = {\n  levels: {\n    debug: 0,\n    log: 1,\n    warn: 2,\n    error: 3,\n  },\n  severity: \"log\",\n  printLevel: true,\n  printDate: true,\n};\n\nvar log = logger.createLogger(defaultConfig);\n\n// this call will use default console\nconsole.log(\"This method use console\");\n\nlog.patchConsole();\n\n// all of the following console calls will use your react-native-logs logger\nconsole.log(\"This method use your logger\");\nconsole.warn(\"This method use your logger too\");\nconsole.debug(\"this message will not be shown\"); // severity is set to 'log'\n```\n\n## Usage Tips\n\n### Logs only in development mode\n\nIn reacly-native, after you have create your logger, you can set to log only in development using\nthe `__DEV__` as follows:\n\n```javascript\nimport {\n  logger,\n  consoleTransport,\n  fileAsyncTransport,\n} from \"react-native-logs\";\nimport RNFS from \"react-native-fs\";\n\nconst config = {\n  transport: __DEV__ ? consoleTransport : fileAsyncTransport,\n  severity: __DEV__ ? \"debug\" : \"error\",\n  transportOptions: {\n    colors\n    FS: RNFS,\n  },\n};\n\nvar log = logger.createLogger();\n```\n\nThis will block all the logs in production, but not the errors, so the app performance will not be\naffected. This will also change the transport: print to console in development and save to file in production.\n\n### Global logger in react-native\n\nIn order to have a global logger throughout the app, i recommend using a config.js file to\ninitialize the logger so it can be imported wherever it is needed. Example:\n\n```javascript\n//config.js\nimport {\n  logger,\n  consoleTransport,\n  fileAsyncTransport,\n} from \"react-native-logs\";\nimport RNFS from \"react-native-fs\";\n\nvar LOG = logger.createLogger({\n  transport: __DEV__ ? consoleTransport : fileAsyncTransport,\n  severity: __DEV__ ? \"debug\" : \"error\",\n  transportOptions: {\n    colors: {\n      info: \"blueBright\",\n      warn: \"yellowBright\",\n      error: \"redBright\",\n    },\n    FS: RNFS,\n  },\n});\n\nexport { LOG };\n```\n\n```javascript\n//index.js and other app files\nimport { LOG } from \"./config\";\n\nLOG.info(\"app log test\");\n```\n\nTo use extended loggers in all files you can also re-declare them:\n\n```javascript\n//root.js\nimport { LOG } from \"./config\";\nvar log = LOG.extend(\"ROOT\");\n\nlog.info(\"root log test\");\n```\n\n```javascript\n//root2.js\nimport { LOG } from \"./config\";\nvar log = LOG.extend(\"ROOT\");\n\nlog.info(\"root log test\");\n```\n\n```javascript\n//home.js\nimport { LOG } from \"./config\";\nvar log = LOG.extend(\"HOME\");\n\nlog.info(\"home log test\");\n```\n\n### Use multiple transports\n\nTo use multiple transports by passing it as an Array:\n\n```javascript\nimport {\n  logger,\n  consoleTransport,\n  fileAsyncTransport,\n  sentryTransport,\n  crashlyticsTransport,\n  transportFunctionType,\n} from \"react-native-logs\";\nimport RNFS from \"react-native-fs\";\nimport * as Sentry from \"@sentry/react-native\";\nimport crashlytics from \"@react-native-firebase/crashlytics\";\n\nconst crashlyticsModule = crashlytics();\n\nvar customTransport: transportFunctionType = (props) =\u003e {\n  // Do here whatever you want with the log message\n  // Eg. a console log: console.log(props.level.text, props.msg)\n};\n\nconst log = logger.createLogger({\n  transport: [\n    consoleTransport,\n    fileAsyncTransport,\n    sentryTransport,\n    crashlyticsTransport,\n    customTransport,\n  ],\n  transportOptions: {\n    FS: RNFS,\n    SENTRY: Sentry,\n    CRASHLYTICS: crashlyticsModule,\n    colors: {\n      info: \"blueBright\",\n      warn: \"yellowBright\",\n      error: \"redBright\",\n    },\n  },\n});\n```\n\n### Improve performance\n\nIn react-native you can improve performance by setting the `InteractionManager.runAfterInteractions` async function:\n\n```javascript\nimport { logger } from \"react-native-logs\";\n\nconst InteractionManager = require(\"react-native\").InteractionManager;\n\nconst log = logger.createLogger({\n  async: true,\n  asyncFunc: InteractionManager.runAfterInteractions,\n});\n```\n\n## Sponsors\n\n\u003ca href=\"https://mowi.space\"\u003e\u003cimg src=\"https://serve.mowi.space/assets/logos/mowi_purple.png\" width=\"350\"/\u003e\u003c/a\u003e\n","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmowispace%2Freact-native-logs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmowispace%2Freact-native-logs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmowispace%2Freact-native-logs/lists"}