Giter VIP home page Giter VIP logo

Comments (5)

alessandro-bottamedi avatar alessandro-bottamedi commented on May 27, 2024

Can you give me the full code of how you pass the error to the logger and which transport do you use?

from react-native-logs.

fuggerstadt1907 avatar fuggerstadt1907 commented on May 27, 2024

Hi @alessandro-bottamedi sure, here is an example

return (
    <CustomView
      style={styles.view}
      accessibilityLabel={A11y.DEVICE_INFO}
      fullSize={!!language}
      header={
        <AppHeader
          onPressClose={navigateToDetail}
          title={I18n.Interface.DEVICE_DETAILS.OPERATING_INSTRUCTIONS.HEADER_TITLE}
        />
      }>
      {!language &&
        OPERATING_INSTRUCTIONS_LANGUAGES.map(({ key, label }) => (
          <ListElement
            key={key}
            accessibilityLabel={label}
            title={label}
            bottomDivider
            chevron
            onPress={() => setLanguage(key)}
          />
        ))}
      {language && (
        <Pdf
          source={source}
          onError={error => log.error('Error while presenting PDF', error)}
          style={styles.pdf}
          scale={0.95}
          minScale={0.95}
        />
      )}
    </CustomView>
  )

log.error('Error while presenting PDF', error) produces the following log in my console:

20/01/2021, 08:07:52 | ERROR | Error while presenting PDF
20/01/2021, 08:07:52 | ERROR | {}

Also irritating, that this is printed in two separate lines 😞

When I chance log.error to console.error the full error is printed properly

The logger is configured as follows

import { logger } from 'react-native-logs'
import { colorConsoleSync } from 'react-native-logs/dist/transports/colorConsoleSync'

import { Config } from '../constants'

const defaultConfig = {
  severity: Config.LOGGER_SEVERITY,
  transport: colorConsoleSync,
  transportOptions: null,
  levels: {
    trace: 0,
    debug: 1,
    info: 2,
    warn: 3,
    error: 4,
  },
}
const log = logger.createLogger(defaultConfig)

export { log }

from react-native-logs.

alessandro-bottamedi avatar alessandro-bottamedi commented on May 27, 2024

I will soon release version 3 which will fix this bug and also concantenation on the same line, for now try using:

log.error('Error while presenting PDF', error.message)

from react-native-logs.

alessandro-bottamedi avatar alessandro-bottamedi commented on May 27, 2024

Fixed in v 3.0.0

from react-native-logs.

fuggerstadt1907 avatar fuggerstadt1907 commented on May 27, 2024

thx @alessandro-bottamedi I'll check out v3 today ✌️

from react-native-logs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.