pylons.tsx 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. import {Layout, LayoutProps} from 'sentry/components/onboarding/gettingStartedDoc/layout';
  2. import {ModuleProps} from 'sentry/components/onboarding/gettingStartedDoc/sdkDocumentation';
  3. import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/step';
  4. import {t, tct} from 'sentry/locale';
  5. // Configuration Start
  6. export const steps = ({
  7. dsn,
  8. }: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
  9. {
  10. type: StepType.INSTALL,
  11. description: (
  12. <p>
  13. {tct(
  14. 'If you haven’t already, start by downloading Raven. The easiest way is with [code:pip]:',
  15. {code: <code />}
  16. )}
  17. </p>
  18. ),
  19. configurations: [
  20. {
  21. language: 'bash',
  22. code: 'pip install raven --upgrade',
  23. },
  24. ],
  25. },
  26. {
  27. title: t('WSGI Middleware'),
  28. configurations: [
  29. {
  30. language: 'python',
  31. description: t(
  32. 'A Pylons-specific middleware exists to enable easy configuration from settings:'
  33. ),
  34. code: `
  35. from raven.contrib.pylons import Sentry
  36. application = Sentry(application, config)
  37. `,
  38. },
  39. {
  40. language: 'ini',
  41. description: t('Configuration is handled via the sentry namespace:'),
  42. code: `
  43. [sentry]
  44. dsn=${dsn}
  45. include_paths=my.package,my.other.package,
  46. exclude_paths=my.package.crud
  47. `,
  48. },
  49. ],
  50. },
  51. {
  52. title: t('Logger setup'),
  53. configurations: [
  54. {
  55. language: 'python',
  56. description: (
  57. <p>
  58. {tct(
  59. 'Add the following lines to your project’s [initCode:.ini] file to setup [sentryHandlerCode:SentryHandler]:',
  60. {
  61. initCode: <code />,
  62. sentryHandlerCode: <code />,
  63. }
  64. )}
  65. </p>
  66. ),
  67. code: `
  68. [loggers]
  69. keys = root, sentry
  70. [handlers]
  71. keys = console, sentry
  72. [formatters]
  73. keys = generic
  74. [logger_root]
  75. level = INFO
  76. handlers = console, sentry
  77. [logger_sentry]
  78. level = WARN
  79. handlers = console
  80. qualname = sentry.errors
  81. propagate = 0
  82. [handler_console]
  83. class = StreamHandler
  84. args = (sys.stderr,)
  85. level = NOTSET
  86. formatter = generic
  87. [handler_sentry]
  88. class = raven.handlers.logging.SentryHandler
  89. args = ('SENTRY_DSN',)
  90. level = NOTSET
  91. formatter = generic
  92. [formatter_generic]
  93. format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
  94. datefmt = %H:%M:%S
  95. `,
  96. },
  97. ],
  98. additionalInfo: t('You may want to set up other loggers as well.'),
  99. },
  100. ];
  101. // Configuration End
  102. export function GettingStartedWithPylons({dsn, ...props}: ModuleProps) {
  103. return <Layout steps={steps({dsn})} {...props} />;
  104. }
  105. export default GettingStartedWithPylons;