Welcome to mirror list, hosted at ThFree Co, Russian Federation.

app_logger_spec.rb « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 85ca60d539f9262247ac9caff0577247203de69f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Gitlab::AppLogger do
  subject { described_class }

  it 'builds two Logger instances' do
    expect(Gitlab::Logger).to receive(:new).and_call_original
    expect(Gitlab::JsonLogger).to receive(:new).and_call_original

    subject.info('Hello World!')
  end

  it 'logs info to AppLogger and AppJsonLogger' do
    expect_any_instance_of(Gitlab::AppTextLogger).to receive(:info).and_call_original
    expect_any_instance_of(Gitlab::AppJsonLogger).to receive(:info).and_call_original

    subject.info('Hello World!')
  end

  it 'logs info to only the AppJsonLogger when unstructured logs are disabled' do
    stub_env('UNSTRUCTURED_RAILS_LOG', 'false')
    expect_any_instance_of(Gitlab::AppTextLogger).not_to receive(:info).and_call_original
    expect_any_instance_of(Gitlab::AppJsonLogger).to receive(:info).and_call_original

    subject.info('Hello World!')
  end
end