pylons.tsx 2.6 KB

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