Full Code of google/glog for AI

master 53d58e4531c7 cached
121 files
738.3 KB
194.9k tokens
506 symbols
1 requests
Download .txt
Showing preview only (775K chars total). Download the full file or copy to clipboard to get everything.
Repository: google/glog
Branch: master
Commit: 53d58e4531c7
Files: 121
Total size: 738.3 KB

Directory structure:
gitextract_hlt6jbbs/

├── .bazelci/
│   └── presubmit.yml
├── .clang-format
├── .clang-tidy
├── .gitattributes
├── .github/
│   ├── dependabot.yml
│   └── workflows/
│       ├── android.yml
│       ├── cifuzz.yml
│       ├── emscripten.yml
│       ├── linux.yml
│       ├── macos.yml
│       └── windows.yml
├── .gitignore
├── AUTHORS
├── BUILD.bazel
├── CMakeLists.txt
├── CONTRIBUTORS
├── ChangeLog
├── LICENSE.md
├── MODULE.bazel
├── README.rst
├── WORKSPACE.bazel
├── bazel/
│   ├── example/
│   │   ├── BUILD.bazel
│   │   └── main.cc
│   └── glog.bzl
├── cmake/
│   ├── DetermineGflagsNamespace.cmake
│   ├── FindUnwind.cmake
│   ├── GetCacheVariables.cmake
│   ├── RunCleanerTest1.cmake
│   ├── RunCleanerTest2.cmake
│   ├── RunCleanerTest3.cmake
│   ├── TestInitPackageConfig.cmake
│   └── TestPackageConfig.cmake
├── codecov.yml
├── docs/
│   ├── build.md
│   ├── contribute.md
│   ├── failures.md
│   ├── flags.md
│   ├── index.md
│   ├── license.md
│   ├── log_cleaner.md
│   ├── log_stripping.md
│   ├── logging.md
│   ├── overrides/
│   │   └── main.html
│   ├── packages.md
│   ├── requirements.txt
│   ├── sinks.md
│   ├── unwinder.md
│   ├── usage.md
│   └── windows.md
├── examples/
│   └── custom_sink.cc
├── gcovr.cfg
├── glog-config.cmake.in
├── glog-modules.cmake.in
├── libglog.pc.in
├── mkdocs.yml
└── src/
    ├── base/
    │   ├── commandlineflags.h
    │   └── googleinit.h
    ├── cleanup_immediately_unittest.cc
    ├── cleanup_with_absolute_prefix_unittest.cc
    ├── cleanup_with_relative_prefix_unittest.cc
    ├── config.h.cmake.in
    ├── dcheck_unittest/
    │   ├── CMakeLists.txt
    │   └── glog_dcheck.cc
    ├── demangle.cc
    ├── demangle.h
    ├── demangle_unittest.cc
    ├── demangle_unittest.sh
    ├── demangle_unittest.txt
    ├── flags.cc
    ├── fuzz_demangle.cc
    ├── glog/
    │   ├── flags.h
    │   ├── log_severity.h
    │   ├── logging.h
    │   ├── platform.h
    │   ├── raw_logging.h
    │   ├── stl_logging.h
    │   ├── types.h
    │   └── vlog_is_on.h
    ├── googletest.h
    ├── includes_unittest/
    │   ├── CMakeLists.txt
    │   ├── glog_includes_logging.cc
    │   ├── glog_includes_raw_logging.cc
    │   ├── glog_includes_stl_logging.cc
    │   └── glog_includes_vlog_is_on.cc
    ├── log_severity_unittest/
    │   ├── CMakeLists.txt
    │   ├── glog_log_severity_constants.cc
    │   └── glog_log_severity_conversion.cc
    ├── logging.cc
    ├── logging_striplog_test.sh
    ├── logging_unittest.cc
    ├── logging_unittest.err
    ├── logging_unittest.out
    ├── mock-log.h
    ├── mock-log_unittest.cc
    ├── package_config_unittest/
    │   └── working_config/
    │       ├── CMakeLists.txt
    │       └── glog_package_config.cc
    ├── raw_logging.cc
    ├── signalhandler.cc
    ├── signalhandler_unittest.cc
    ├── signalhandler_unittest.sh
    ├── stacktrace.cc
    ├── stacktrace.h
    ├── stacktrace_generic-inl.h
    ├── stacktrace_libunwind-inl.h
    ├── stacktrace_powerpc-inl.h
    ├── stacktrace_unittest.cc
    ├── stacktrace_unwind-inl.h
    ├── stacktrace_windows-inl.h
    ├── stacktrace_x86-inl.h
    ├── stl_logging_unittest.cc
    ├── striplog_unittest.cc
    ├── symbolize.cc
    ├── symbolize.h
    ├── symbolize_unittest.cc
    ├── utilities.cc
    ├── utilities.h
    ├── utilities_unittest.cc
    ├── vlog_is_on.cc
    └── windows/
        ├── dirent.h
        ├── port.cc
        └── port.h

================================================
FILE CONTENTS
================================================

================================================
FILE: .bazelci/presubmit.yml
================================================
---
tasks:
  ubuntu1804:
    name: "Ubuntu 22.04"
    platform: ubuntu2204
    build_flags:
    - "--features=layering_check"
    - "--copt=-Werror"
    build_targets:
    - "//..."
    test_flags:
    - "--features=layering_check"
    - "--copt=-Werror"
    test_targets:
    - "//..."
  macos:
    name: "macOS: latest Xcode"
    platform: macos
    build_flags:
    - "--features=layering_check"
    - "--copt=-Werror"
    build_targets:
    - "//..."
    test_flags:
    - "--features=layering_check"
    - "--copt=-Werror"
    test_targets:
    - "//..."
  windows-msvc:
    name: "Windows: MSVC 2017"
    platform: windows
    environment:
      BAZEL_VC: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC"
    build_flags:
    - "--features=layering_check"
    - "--copt=/WX"
    build_targets:
    - "//..."
    test_flags:
    - "--features=layering_check"
    - "--copt=/WX"
    test_targets:
    - "//..."
  windows-clang-cl:
    name: "Windows: Clang"
    platform: windows
    environment:
      BAZEL_VC: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC"
    build_flags:
    - "--extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl"
    - "--extra_execution_platforms=//:x64_windows-clang-cl"
    - "--compiler=clang-cl"
    - "--features=layering_check"
    build_targets:
    - "//..."
    test_flags:
    - "--extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl"
    - "--extra_execution_platforms=//:x64_windows-clang-cl"
    - "--compiler=clang-cl"
    - "--features=layering_check"
    test_targets:
    - "//..."


================================================
FILE: .clang-format
================================================
---
Language:        Cpp
# BasedOnStyle:  Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: false
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands:   true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
  AfterCaseLabel:  false
  AfterClass:      false
  AfterControlStatement: false
  AfterEnum:       false
  AfterFunction:   false
  AfterNamespace:  false
  AfterObjCDeclaration: false
  AfterStruct:     false
  AfterUnion:      false
  AfterExternBlock: false
  BeforeCatch:     false
  BeforeElse:      false
  IndentBraces:    false
  SplitEmptyFunction: true
  SplitEmptyRecord: true
  SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit:     80
CommentPragmas:  '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat:   false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
  - foreach
  - Q_FOREACH
  - BOOST_FOREACH
IncludeBlocks:   Regroup
IncludeCategories:
  - Regex:           '^<ext/.*\.h>'
    Priority:        2
    SortPriority:    0
  - Regex:           '^<.*\.h>'
    Priority:        1
    SortPriority:    0
  - Regex:           '^<.*'
    Priority:        2
    SortPriority:    0
  - Regex:           '.*'
    Priority:        3
    SortPriority:    0
IncludeIsMainRegex: '([-_](test|unittest))?$'
IncludeIsMainSourceRegex: ''
IndentCaseLabels: true
IndentGotoLabels: true
IndentPPDirectives: AfterHash
IndentWidth:     2
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd:   ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Never
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
RawStringFormats:
  - Language:        Cpp
    Delimiters:
      - cc
      - CC
      - cpp
      - Cpp
      - CPP
      - 'c++'
      - 'C++'
    CanonicalDelimiter: ''
    BasedOnStyle:    google
  - Language:        TextProto
    Delimiters:
      - pb
      - PB
      - proto
      - PROTO
    EnclosingFunctions:
      - EqualsProto
      - EquivToProto
      - PARSE_PARTIAL_TEXT_PROTO
      - PARSE_TEST_PROTO
      - PARSE_TEXT_PROTO
      - ParseTextOrDie
      - ParseTextProtoOrDie
    CanonicalDelimiter: ''
    BasedOnStyle:    google
ReflowComments:  true
SortIncludes:    true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles:  false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
Standard:        c++14
StatementMacros:
  - Q_UNUSED
  - QT_REQUIRE_VERSION
TabWidth:        8
UseCRLF:         false
UseTab:          Never
...



================================================
FILE: .clang-tidy
================================================
---
Checks:          'clang-diagnostic-*,clang-analyzer-*,google-*,modernize-*,-modernize-use-trailing-return-type,readability-*,portability-*,performance-*,bugprone-*,android-*,darwin-*,clang-analyzer-*'
WarningsAsErrors: ''
HeaderFilterRegex: ''
FormatStyle:     file
CheckOptions:
  - key:             cert-dcl16-c.NewSuffixes
    value:           'L;LL;LU;LLU'
  - key:             cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField
    value:           '0'
  - key:             cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors
    value:           '1'
  - key:             cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
    value:           '1'
  - key:             google-build-namespaces.HeaderFileExtensions
    value:           ',h,hh,hpp,hxx'
  - key:             google-global-names-in-headers.HeaderFileExtensions
    value:           ',h,hh,hpp,hxx'
  - key:             google-readability-braces-around-statements.ShortStatementLines
    value:           '1'
  - key:             google-readability-function-size.BranchThreshold
    value:           '4294967295'
  - key:             google-readability-function-size.LineThreshold
    value:           '4294967295'
  - key:             google-readability-function-size.NestingThreshold
    value:           '4294967295'
  - key:             google-readability-function-size.ParameterThreshold
    value:           '4294967295'
  - key:             google-readability-function-size.StatementThreshold
    value:           '800'
  - key:             google-readability-function-size.VariableThreshold
    value:           '4294967295'
  - key:             google-readability-namespace-comments.ShortNamespaceLines
    value:           '10'
  - key:             google-readability-namespace-comments.SpacesBeforeComments
    value:           '2'
  - key:             google-runtime-int.SignedTypePrefix
    value:           int
  - key:             google-runtime-int.TypeSuffix
    value:           ''
  - key:             google-runtime-int.UnsignedTypePrefix
    value:           uint
  - key:             google-runtime-references.WhiteListTypes
    value:           ''
  - key:             modernize-loop-convert.MaxCopySize
    value:           '16'
  - key:             modernize-loop-convert.MinConfidence
    value:           reasonable
  - key:             modernize-loop-convert.NamingStyle
    value:           CamelCase
  - key:             modernize-pass-by-value.IncludeStyle
    value:           llvm
  - key:             modernize-replace-auto-ptr.IncludeStyle
    value:           llvm
  - key:             modernize-use-nullptr.NullMacros
    value:           'NULL'
...



================================================
FILE: .gitattributes
================================================
*.h linguist-language=C++


================================================
FILE: .github/dependabot.yml
================================================
# Set update schedule for GitHub Actions

version: 2
updates:

  - package-ecosystem: "github-actions"
    directory: "/"
    schedule:
      # Check for updates to GitHub Actions every week
      interval: "weekly"


================================================
FILE: .github/workflows/android.yml
================================================
name: Android

on: [push, pull_request]

jobs:
  build-android:
    name: NDK-C++${{matrix.std}}-${{matrix.abi}}-${{matrix.build_type}}
    runs-on: ubuntu-22.04
    permissions:
      actions: read
      contents: read
      security-events: write
    defaults:
      run:
        shell: bash
    env:
      NDK_VERSION: 26.0.10792818
    strategy:
      fail-fast: true
      matrix:
        std: [14, 17, 20]
        abi: [arm64-v8a, armeabi-v7a, x86_64, x86]
        build_type: [Debug, Release]

    steps:
      - uses: actions/checkout@v4

      - name: Initialize CodeQL
        uses: github/codeql-action/init@v3
        with:
          languages: cpp

      - name: Setup Dependencies
        run: |
          sudo apt-get update
          DEBIAN_FRONTEND=noninteractive sudo apt-get install -y \
            cmake \
            ninja-build

      - name: Setup NDK
        env:
          ANDROID_SDK_ROOT: /usr/local/lib/android/sdk
        run: |
          echo 'y' | ${{env.ANDROID_SDK_ROOT}}/cmdline-tools/latest/bin/sdkmanager --install 'ndk;${{env.NDK_VERSION}}'

      - name: Configure
        env:
          CXXFLAGS: -Wall -Wextra -Wpedantic -Wsign-conversion -Wtautological-compare -Wformat-nonliteral -Wundef -Werror ${{env.CXXFLAGS}}
        run: |
          cmake -S . -B build_${{matrix.abi}} \
                -DCMAKE_ANDROID_API=28 \
                -DCMAKE_ANDROID_ARCH_ABI=${{matrix.abi}} \
                -DCMAKE_ANDROID_NDK=/usr/local/lib/android/sdk/ndk/${{env.NDK_VERSION}} \
                -DCMAKE_ANDROID_STL_TYPE=c++_shared \
                -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
                -DCMAKE_CXX_EXTENSIONS=OFF \
                -DCMAKE_CXX_STANDARD=${{matrix.std}} \
                -DCMAKE_CXX_STANDARD_REQUIRED=ON \
                -DCMAKE_SYSTEM_NAME=Android \
                -G Ninja \
                -Werror

      - name: Build
        run: |
          cmake --build build_${{matrix.abi}} \
                --config ${{matrix.build_type}}

      - name: Perform CodeQL Analysis
        uses: github/codeql-action/analyze@v3


================================================
FILE: .github/workflows/cifuzz.yml
================================================
name: CIFuzz
on: [pull_request]
jobs:
  Fuzzing:
    runs-on: ubuntu-latest
    steps:
    - name: Build Fuzzers
      id: build
      uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
      with:
        oss-fuzz-project-name: 'glog'
        dry-run: false
        language: c++
    - name: Run Fuzzers
      uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
      with:
        oss-fuzz-project-name: 'glog'
        fuzz-seconds: 60
        dry-run: false
        language: c++
    - name: Upload Crash
      uses: actions/upload-artifact@v4
      if: failure() && steps.build.outcome == 'success'
      with:
        name: artifacts
        path: ./out/artifacts


================================================
FILE: .github/workflows/emscripten.yml
================================================
name: Emscripten

on: [push, pull_request]

jobs:
  build-linux:
    defaults:
      run:
        shell: bash
    name: Emscripten-C++${{matrix.std}}-${{matrix.build_type}}-${{matrix.lib}}
    runs-on: ubuntu-22.04
    permissions:
      actions: read
      contents: read
      security-events: write
    container: emscripten/emsdk
    strategy:
      fail-fast: true
      matrix:
        build_type: [Release, Debug]
        lib: [static]
        std: [14, 17, 20, 23]

    steps:
      - uses: actions/checkout@v4

      - name: Initialize CodeQL
        uses: github/codeql-action/init@v3
        with:
          languages: cpp

      - name: Setup Dependencies
        run: |
          sudo apt-get update
          DEBIAN_FRONTEND=noninteractive sudo apt-get install -y \
            cmake \
            ninja-build

      - name: Configure
        env:
          CXXFLAGS: -Wall -Wextra -Wsign-conversion -Wtautological-compare -Wformat-nonliteral -Wundef -Werror -Wno-error=wasm-exception-spec ${{env.CXXFLAGS}}
        run: |
          emcmake cmake -S . -B build_${{matrix.build_type}} \
            -DBUILD_SHARED_LIBS=${{matrix.lib == 'shared'}} \
            -DCMAKE_CXX_STANDARD=${{matrix.std}} \
            -DCMAKE_CXX_STANDARD_REQUIRED=ON \
            -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install \
            -G Ninja \
            -Werror

      - name: Build
        run: |
          cmake --build build_${{matrix.build_type}} \
                --config ${{matrix.build_type}}

      - name: Perform CodeQL Analysis
        uses: github/codeql-action/analyze@v3


================================================
FILE: .github/workflows/linux.yml
================================================
name: Linux

on: [push, pull_request]

jobs:
  build-linux:
    defaults:
      run:
        shell: bash
    name: GCC-C++${{matrix.std}}-${{matrix.build_type}}-${{matrix.lib}}
    runs-on: ubuntu-22.04
    permissions:
      actions: read
      contents: read
      security-events: write
    strategy:
      fail-fast: true
      matrix:
        build_type: [Release, Debug]
        lib: [shared, static]
        std: [14, 17, 20, 23]

    steps:
      - uses: actions/checkout@v4

      - name: Initialize CodeQL
        uses: github/codeql-action/init@v3
        with:
          languages: cpp

      - name: Setup Dependencies
        run: |
          sudo apt-get update
          DEBIAN_FRONTEND=noninteractive sudo apt-get install -y --no-install-suggests --no-install-recommends \
            g++ \
            cmake \
            gcovr \
            libgflags-dev \
            libgmock-dev \
            libgtest-dev \
            libunwind-dev \
            ninja-build

      - name: Setup Environment
        if: matrix.build_type == 'Debug'
        run: |
          echo 'CXXFLAGS=--coverage' >> $GITHUB_ENV

      - name: Configure
        env:
          CXXFLAGS: -Wall -Wextra -Wsign-conversion -Wtautological-compare -Wformat-nonliteral -Wundef -Werror ${{env.CXXFLAGS}}
        run: |
          cmake -S . -B build_${{matrix.build_type}} \
            -DBUILD_SHARED_LIBS=${{matrix.lib == 'shared'}} \
            -DCMAKE_CXX_STANDARD=${{matrix.std}} \
            -DCMAKE_CXX_STANDARD_REQUIRED=ON \
            -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install \
            -G Ninja \
            -Werror

      - name: Build
        run: |
          cmake --build build_${{matrix.build_type}} \
                --config ${{matrix.build_type}}

      - name: Install
        run: |
          cmake --build build_${{matrix.build_type}} \
                --config ${{matrix.build_type}} \
                --target install

          cmake build_${{matrix.build_type}} \
                -DCMAKE_INSTALL_INCLUDEDIR=${{runner.workspace}}/foo/include \
                -DCMAKE_INSTALL_LIBDIR=${{runner.workspace}}/foo/lib \
                -DCMAKE_INSTALL_DATAROOTDIR=${{runner.workspace}}/foo/share
          cmake --build build_${{matrix.build_type}} \
                --config ${{matrix.build_type}} \
                --target install

      - name: Test CMake Package (relative GNUInstallDirs)
        run: |
          cmake -S src/package_config_unittest/working_config \
                -B build_${{matrix.build_type}}_package \
                -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
                -DCMAKE_PREFIX_PATH=${{github.workspace}}/install \
                -G Ninja
          cmake --build build_${{matrix.build_type}}_package \
                --config ${{matrix.build_type}}

      - name: Test CMake Package (absolute GNUInstallDirs)
        run: |
          cmake -S src/package_config_unittest/working_config \
                -B build_${{matrix.build_type}}_package_foo \
                -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
                -DCMAKE_PREFIX_PATH=${{runner.workspace}}/foo \
                -G Ninja
          cmake --build build_${{matrix.build_type}}_package_foo \
                --config ${{matrix.build_type}}

      - name: Test
        run: |
          ctest --test-dir build_${{matrix.build_type}} -j$(nproc) --output-on-failure

      - name: Generate Coverage
        if: matrix.build_type == 'Debug'
        run: |
          cd build_${{matrix.build_type}}
          gcovr -r .. . -s --xml coverage.xml

      - name: Upload Coverage to Codecov
        if: matrix.build_type == 'Debug'
        uses: codecov/codecov-action@v5
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          files: build_${{matrix.build_type}}/coverage.xml
          fail_ci_if_error: true
          verbose: true

      - name: Perform CodeQL Analysis
        uses: github/codeql-action/analyze@v3


================================================
FILE: .github/workflows/macos.yml
================================================
name: macOS

on: [push, pull_request]

jobs:
  build-macos:
    name: AppleClang-C++${{matrix.std}}-${{matrix.build_type}}
    runs-on: macos-12
    permissions:
      actions: read
      contents: read
      security-events: write
    strategy:
      fail-fast: true
      matrix:
        std: [14, 17, 20, 23]
        include:
          - generator: Xcode
          - build_type: Debug

    steps:
      - uses: actions/checkout@v4

      - name: Setup Dependencies
        run: |
          brew install ninja

      - name: Setup Coverage Dependencies
        if: matrix.build_type == 'Debug'
        run: |
          brew install gcovr

      - name: Setup Environment
        if: matrix.build_type == 'Debug'
        run: |
          echo 'CXXFLAGS=--coverage' >> $GITHUB_ENV
          echo 'LDFLAGS=--coverage' >> $GITHUB_ENV

      - name: Configure
        shell: bash
        env:
          CXXFLAGS: -Wall -Wextra -Wsign-conversion -Wtautological-compare -Wformat-nonliteral -Wundef -Werror -pedantic-errors ${{env.CXXFLAGS}}
        run: |
          cmake -S . -B build_${{matrix.build_type}} \
                -DCMAKE_CXX_EXTENSIONS=OFF \
                -DCMAKE_CXX_STANDARD=${{matrix.std}} \
                -DCMAKE_CXX_STANDARD_REQUIRED=ON \
                -G "${{matrix.generator}}" \
                -Werror

      - name: Build
        run: |
          cmake --build build_${{matrix.build_type}} \
                --config ${{matrix.build_type}}

      - name: Test
        run: |
          ctest --test-dir build_${{matrix.build_type}} \
                --build-config ${{matrix.build_type}} \
                --output-on-failure

      - name: Generate Coverage
        if: matrix.build_type == 'Debug'
        run: |
          cd build_${{matrix.build_type}}
          rm -r Tests/
          gcovr -r .. . -s --cobertura coverage.xml

      - name: Upload Coverage to Codecov
        if: matrix.build_type == 'Debug'
        uses: codecov/codecov-action@v5
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          files: build_${{matrix.build_type}}/coverage.xml
          fail_ci_if_error: true
          verbose: true


================================================
FILE: .github/workflows/windows.yml
================================================
name: Windows

on: [push, pull_request]

jobs:
  build-msvc:
    name: ${{matrix.msvc}}-${{matrix.arch}}-C++${{matrix.std}}-${{matrix.build_type}}-${{matrix.lib}}
    runs-on: ${{matrix.os}}
    permissions:
      actions: read
      contents: read
      security-events: write
    defaults:
      run:
        shell: powershell
    env:
      CL: /MP
      CXXFLAGS: /WX /permissive-
    strategy:
      fail-fast: true
      matrix:
        arch: [Win32, x64]
        build_type: [Debug, Release]
        lib: [shared, static]
        msvc: [VS-16-2019, VS-17-2022]
        std: [14, 17, 20, 23]
        include:
          - msvc: VS-16-2019
            os: windows-2019
            generator: 'Visual Studio 16 2019'
          - msvc: VS-17-2022
            os: windows-2022
            generator: 'Visual Studio 17 2022'

    steps:
      - uses: actions/checkout@v4

      - name: Initialize CodeQL
        uses: github/codeql-action/init@v3
        with:
          languages: cpp

      - name: Cache GTest
        id: cache-gtest
        uses: actions/cache@v4
        with:
          path: gtest/
          key: ${{runner.os}}-gtest-1.14-${{matrix.lib}}-${{matrix.arch}}-${{matrix.build_type}}

      - name: Download GTest
        if: steps.cache-gtest.outputs.cache-hit != 'true'
        run: |
          (New-Object System.Net.WebClient).DownloadFile("https://github.com/google/googletest/archive/refs/tags/v1.14.0.zip", "v1.14.0.zip")
          Expand-Archive v1.14.0.zip .

      - name: Build GTest
        if: steps.cache-gtest.outputs.cache-hit != 'true'
        run: |
          cmake -S googletest-1.14.0 -B build-googletest `
                -A ${{matrix.arch}} `
                -DBUILD_SHARED_LIBS=${{matrix.lib == 'shared'}} `
                -Dgtest_force_shared_crt=ON `
                -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/gtest
          cmake --build build-googletest `
                --config ${{matrix.build_type}} `
                --target install

      - name: Cache gflags
        id: cache-gflags
        uses: actions/cache@v4
        with:
          path: gflags/
          key: ${{runner.os}}-gflags-2.2.2-${{matrix.lib}}-${{matrix.arch}}-${{matrix.build_type}}

      - name: Download gflags
        if: steps.cache-gflags.outputs.cache-hit != 'true'
        run: |
          (New-Object System.Net.WebClient).DownloadFile("https://github.com/gflags/gflags/archive/refs/tags/v2.2.2.zip", "v2.2.2.zip")
          Expand-Archive v2.2.2.zip .

      - name: Build gflags
        if: steps.cache-gflags.outputs.cache-hit != 'true'
        run: |
          cmake -S gflags-2.2.2 -B build-gflags `
                -A ${{matrix.arch}} `
                -DBUILD_SHARED_LIBS=${{matrix.lib == 'shared'}} `
                -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/gflags
          cmake --build build-gflags `
                --config ${{matrix.build_type}} `
                --target install

      - name: Setup Environment
        run: |
          echo "GTest_ROOT=$((Get-Item .).FullName)/gtest" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
          echo "gflags_ROOT=$((Get-Item .).FullName)/gflags" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
          echo "${{github.workspace}}/gtest/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
          echo "${{github.workspace}}/gflags/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append

      - name: Setup Release Environment
        if: matrix.build_type != 'Debug'
        run: |
          echo "CXXFLAGS=/Zi ${{env.CXXFLAGS}}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append

      - name: Configure
        run: |
          cmake -S . -B build_${{matrix.build_type}} `
                -A ${{matrix.arch}} `
                -DBUILD_SHARED_LIBS=${{matrix.lib == 'shared'}} `
                -DCMAKE_CXX_EXTENSIONS=OFF `
                -DCMAKE_CXX_STANDARD=${{matrix.std}} `
                -DCMAKE_CXX_STANDARD_REQUIRED=ON `
                -DCMAKE_EXE_LINKER_FLAGS='/NOIMPLIB' `
                -DCMAKE_EXE_LINKER_FLAGS_RELEASE='/INCREMENTAL:NO /DEBUG' `
                -DCMAKE_INSTALL_PREFIX:PATH=./install `
                -DCMAKE_MSVC_RUNTIME_LIBRARY='MultiThreaded$<$<CONFIG:Debug>:Debug>DLL' `
                -G "${{matrix.generator}}" `
                -Werror

      - name: Build
        run: cmake --build build_${{matrix.build_type}} `
                   --config ${{matrix.build_type}}

      - name: Test
        env:
          CTEST_OUTPUT_ON_FAILURE: 1
        run: |
          cmake --build build_${{matrix.build_type}}/ `
                --config ${{matrix.build_type}} `
                --target RUN_TESTS

      - name: Install
        run: |
          cmake --build build_${{matrix.build_type}}/ `
                --config ${{matrix.build_type}} `
                --target install

      - name: Perform CodeQL Analysis
        uses: github/codeql-action/analyze@v3
        with:
          category: language:cpp

  build-mingw:
    name: ${{matrix.sys}}-${{matrix.env}}-C++${{matrix.std}}-${{matrix.build_type}}-${{matrix.lib}}
    runs-on: windows-2022
    permissions:
      actions: read
      contents: read
      security-events: write
    env:
      BUILDDIR: 'build_${{matrix.sys}}-${{matrix.env}}-C++${{matrix.std}}-${{matrix.build_type}}-${{matrix.lib}}'
    defaults:
      run:
        shell: msys2 {0}
    strategy:
      fail-fast: true
      matrix:
        build_type: [Debug]
        lib: [shared, static]
        std: [14, 17, 20, 23]
        sys: [mingw32, mingw64]
        include:
         - sys: mingw32
           env: i686
         - sys: mingw64
           env: x86_64

    steps:
      - uses: actions/checkout@v4

      - name: Initialize CodeQL
        uses: github/codeql-action/init@v3
        with:
          languages: cpp

      - uses: msys2/setup-msys2@v2
        with:
          msystem: ${{matrix.sys}}
          install: >-
            mingw-w64-${{matrix.env}}-cmake
            mingw-w64-${{matrix.env}}-gcc
            mingw-w64-${{matrix.env}}-gflags
            mingw-w64-${{matrix.env}}-ninja
            mingw-w64-${{matrix.env}}-python-jinja
            mingw-w64-${{matrix.env}}-python-lxml
            mingw-w64-${{matrix.env}}-python-pip
            mingw-w64-${{matrix.env}}-python-pygments

      - name: Setup Coverage Dependencies
        if: matrix.build_type == 'Debug'
        run: |
          pip install 'gcovr==7.0'

      - name: Setup Environment
        if: matrix.build_type == 'Debug'
        run: |
          echo 'CXXFLAGS=--coverage ${{env.CXXFLAGS}}' >> $GITHUB_ENV

      - name: Configure
        env:
          CXXFLAGS: -Wall -Wextra -Wpedantic -Wsign-conversion -Wtautological-compare -Wformat-nonliteral -Wundef -Werror ${{env.CXXFLAGS}}
        run: |
          cmake -S . -B build_${{matrix.build_type}}/ \
                -DBUILD_SHARED_LIBS=${{matrix.lib == 'shared'}} \
                -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
                -DCMAKE_CXX_EXTENSIONS=OFF \
                -DCMAKE_CXX_STANDARD=${{matrix.std}} \
                -DCMAKE_CXX_STANDARD_REQUIRED=ON \
                -DCMAKE_INSTALL_PREFIX:PATH=./install \
                -G Ninja \
                -Werror

      - name: Build
        run: |
          cmake --build build_${{matrix.build_type}}/ --config ${{matrix.build_type}}

      - name: Test
        env:
          CTEST_OUTPUT_ON_FAILURE: 1
        run: |
          cmake --build build_${{matrix.build_type}}/ --config ${{matrix.build_type}} \
                --target test

      - name: Install
        run: |
          cmake --build build_${{matrix.build_type}}/ \
                --config ${{matrix.build_type}} \
                --target install

      - name: Generate Coverage
        if: matrix.build_type == 'Debug'
        run: |
          cd build_${{matrix.build_type}}
          gcovr -r .. . -s --cobertura coverage.xml

      - name: Upload Coverage to Codecov
        if: matrix.build_type == 'Debug'
        uses: codecov/codecov-action@v5
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          files: build_${{matrix.build_type}}/coverage.xml
          fail_ci_if_error: true
          verbose: true

      - name: Perform CodeQL Analysis
        uses: github/codeql-action/analyze@v3


================================================
FILE: .gitignore
================================================
*.orig
/build*/
/site/
bazel-*
# Bzlmod lockfile
/MODULE.bazel.lock


================================================
FILE: AUTHORS
================================================
# This is the official list of glog authors for copyright purposes.
# This file is distinct from the CONTRIBUTORS files.
# See the latter for an explanation.
#
# Names should be added to this file as:
#	Name or Organization <email address>
# The email address is not required for organizations.
#
# Please keep the list sorted.

Abhishek Dasgupta <abhi2743@gmail.com>
Abhishek Parmar <abhishek@orng.net>
Andrew Schwartzmeyer <andrew@schwartzmeyer.com>
Andy Ying <andy@trailofbits.com>
Brian Silverman <bsilver16384@gmail.com>
Dmitriy Arbitman <d.arbitman@gmail.com>
Google Inc.
Guillaume Dumont <dumont.guillaume@gmail.com>
LingBin <lingbinlb@gmail.com>
Marco Wang <m.aesophor@gmail.com>
Michael Tanner <michael@tannertaxpro.com>
MiniLight <MiniLightAR@Gmail.com>
romange <romange@users.noreply.github.com>
Roman Perepelitsa <roman.perepelitsa@gmail.com>
Sergiu Deitsch <sergiu.deitsch@gmail.com>
tbennun <tbennun@gmail.com>
Teddy Reed <teddy@prosauce.org>
Vijaymahantesh Sattigeri <vijaymahantesh016@gmail.com>
Zhongming Qu <qzmfranklin@gmail.com>
Zhuoran Shen <cmsflash99@gmail.com>


================================================
FILE: BUILD.bazel
================================================
licenses(["notice"])

exports_files(["COPYING"])

load(":bazel/glog.bzl", "glog_library")

glog_library()

# platform() to build with clang-cl on Bazel CI. This is enabled with
# the flags in .bazelci/presubmit.yml:
#
#   --incompatible_enable_cc_toolchain_resolution
#   --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl
#   --extra_execution_platforms=//:x64_windows-clang-cl
platform(
    name = "x64_windows-clang-cl",
    constraint_values = [
        "@platforms//cpu:x86_64",
        "@platforms//os:windows",
        "@rules_cc//cc/private/toolchain:clang-cl",
    ],
)


================================================
FILE: CMakeLists.txt
================================================
cmake_minimum_required (VERSION 3.22)
project (glog
  VERSION 0.8.0
  DESCRIPTION "C++ implementation of the Google logging module"
  HOMEPAGE_URL https://github.com/google/glog
  LANGUAGES CXX
)

set (CPACK_PACKAGE_NAME glog)
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Google logging library")
set (CPACK_PACKAGE_VERSION_MAJOR ${glog_VERSION_MAJOR})
set (CPACK_PACKAGE_VERSION_MINOR ${glog_VERSION_MINOR})
set (CPACK_PACKAGE_VERSION_PATCH ${glog_VERSION_PATCH})
set (CPACK_PACKAGE_VERSION ${glog_VERSION})

list (APPEND CMAKE_MODULE_PATH ${glog_SOURCE_DIR}/cmake)

include (CheckCXXSourceCompiles)
include (CheckCXXSourceRuns)
include (CheckCXXSymbolExists)
include (CheckIncludeFileCXX)
include (CheckStructHasMember)
include (CheckTypeSize)
include (CMakeDependentOption)
include (CMakePackageConfigHelpers)
include (CMakePushCheckState)
include (CPack)
include (CTest)
include (DetermineGflagsNamespace)
include (GenerateExportHeader)
include (GetCacheVariables)
include (GNUInstallDirs)

option (BUILD_SHARED_LIBS "Build shared libraries" ON)
option (BUILD_EXAMPLES "Build examples" ON)
option (PRINT_UNSYMBOLIZED_STACK_TRACES
  "Print file offsets in traces instead of symbolizing" OFF)
option (WITH_GFLAGS "Use gflags" ON)
option (WITH_GTEST "Use Google Test" ON)
option (WITH_PKGCONFIG "Enable pkg-config support" OFF)
option (WITH_SYMBOLIZE "Enable symbolize module" ON)
option (WITH_TLS "Enable Thread Local Storage (TLS) support" ON)

set (WITH_UNWIND libunwind CACHE STRING "unwind driver")
set_property (CACHE WITH_UNWIND PROPERTY STRINGS none unwind libunwind)

cmake_dependent_option (WITH_GMOCK "Use Google Mock" ON WITH_GTEST OFF)

set (WITH_FUZZING none CACHE STRING "Fuzzing engine")
set_property (CACHE WITH_FUZZING PROPERTY STRINGS none libfuzzer ossfuzz)

if (WITH_UNWIND STREQUAL none)
  set (CMAKE_DISABLE_FIND_PACKAGE_Unwind ON)
endif (WITH_UNWIND STREQUAL none)

if (NOT WITH_GTEST)
  set (CMAKE_DISABLE_FIND_PACKAGE_GTest ON)
endif (NOT WITH_GTEST)

set (CMAKE_C_VISIBILITY_PRESET hidden)
set (CMAKE_CXX_VISIBILITY_PRESET hidden)
set (CMAKE_POSITION_INDEPENDENT_CODE ON)
set (CMAKE_VISIBILITY_INLINES_HIDDEN ON)

set (CMAKE_DEBUG_POSTFIX d)

find_package (GTest 1.11 COMPONENTS GTest OPTIONAL_COMPONENTS GMock NO_MODULE)

if (GTest_FOUND)
  set (HAVE_LIB_GTEST 1)
endif (GTest_FOUND)

if (WITH_GMOCK AND TARGET GTest::gmock)
  set (HAVE_LIB_GMOCK 1)
endif (WITH_GMOCK AND TARGET GTest::gmock)

if (WITH_GFLAGS)
  find_package (gflags 2.2.2)

  if (gflags_FOUND)
    set (HAVE_LIB_GFLAGS 1)
    determine_gflags_namespace (gflags_NAMESPACE)
  endif (gflags_FOUND)
endif (WITH_GFLAGS)

find_package (Threads REQUIRED)
find_package (Unwind)

if (Unwind_FOUND)
  cmake_push_check_state (RESET)
  set (CMAKE_REQUIRED_LIBRARIES unwind::unwind)

  # Check whether linking actually succeeds. ARM toolchains of LLVM unwind
  # implementation do not necessarily provide the _Unwind_Backtrace function
  # which causes the previous check to succeed but the linking to fail.
  check_cxx_symbol_exists (_Unwind_Backtrace unwind.h HAVE__UNWIND_BACKTRACE)
  check_cxx_symbol_exists (_Unwind_GetIP unwind.h HAVE__UNWIND_GETIP)

  check_cxx_symbol_exists (unw_get_reg libunwind.h HAVE_UNW_GET_REG)
  check_cxx_symbol_exists (unw_getcontext libunwind.h HAVE_UNW_GETCONTEXT)
  check_cxx_symbol_exists (unw_init_local libunwind.h HAVE_UNW_INIT_LOCAL)
  check_cxx_symbol_exists (unw_step libunwind.h HAVE_UNW_STEP)

  if (HAVE__UNWIND_BACKTRACE AND HAVE__UNWIND_GETIP)
    set (_HAVE_UNWIND 1)
  endif (HAVE__UNWIND_BACKTRACE AND HAVE__UNWIND_GETIP)

  if (HAVE_UNW_GET_REG AND HAVE_UNW_GETCONTEXT AND HAVE_UNW_INIT_LOCAL AND HAVE_UNW_STEP)
    set (_HAVE_LIBUNWIND 1)
  endif (HAVE_UNW_GET_REG AND HAVE_UNW_GETCONTEXT AND HAVE_UNW_INIT_LOCAL AND HAVE_UNW_STEP)

  if (WITH_UNWIND STREQUAL unwind)
    if (_HAVE_UNWIND)
      set (HAVE_UNWIND 1)
    endif (_HAVE_UNWIND)
  elseif (WITH_UNWIND STREQUAL libunwind)
    if (_HAVE_LIBUNWIND)
      set (HAVE_LIBUNWIND 1)
    endif (_HAVE_LIBUNWIND)
  endif (WITH_UNWIND STREQUAL unwind)

  unset (_HAVE_LIBUNWIND)
  unset (_HAVE_UNWIND)

  cmake_pop_check_state ()
endif (Unwind_FOUND)

check_include_file_cxx (dlfcn.h HAVE_DLFCN_H)
check_include_file_cxx (elf.h HAVE_ELF_H)
check_include_file_cxx (glob.h HAVE_GLOB_H)
check_include_file_cxx (link.h HAVE_LINK_H)
check_include_file_cxx (pwd.h HAVE_PWD_H)
check_include_file_cxx (sys/exec_elf.h HAVE_SYS_EXEC_ELF_H)
check_include_file_cxx (sys/syscall.h HAVE_SYS_SYSCALL_H)
check_include_file_cxx (sys/time.h HAVE_SYS_TIME_H)
check_include_file_cxx (sys/types.h HAVE_SYS_TYPES_H)
check_include_file_cxx (sys/utsname.h HAVE_SYS_UTSNAME_H)
check_include_file_cxx (sys/wait.h HAVE_SYS_WAIT_H)
check_include_file_cxx (syscall.h HAVE_SYSCALL_H)
check_include_file_cxx (syslog.h HAVE_SYSLOG_H)
check_include_file_cxx (ucontext.h HAVE_UCONTEXT_H)
check_include_file_cxx (unistd.h HAVE_UNISTD_H)

check_type_size (mode_t HAVE_MODE_T LANGUAGE CXX)
check_type_size (ssize_t HAVE_SSIZE_T LANGUAGE CXX)

check_cxx_symbol_exists (dladdr dlfcn.h HAVE_DLADDR)
check_cxx_symbol_exists (fcntl fcntl.h HAVE_FCNTL)
check_cxx_symbol_exists (posix_fadvise fcntl.h HAVE_POSIX_FADVISE)
check_cxx_symbol_exists (pread unistd.h HAVE_PREAD)
check_cxx_symbol_exists (pwrite unistd.h HAVE_PWRITE)
check_cxx_symbol_exists (sigaction csignal HAVE_SIGACTION)
check_cxx_symbol_exists (sigaltstack csignal HAVE_SIGALTSTACK)

check_cxx_symbol_exists (backtrace execinfo.h HAVE_EXECINFO_BACKTRACE)
check_cxx_symbol_exists (backtrace_symbols execinfo.h
  HAVE_EXECINFO_BACKTRACE_SYMBOLS)
check_cxx_symbol_exists (_chsize_s io.h HAVE__CHSIZE_S)

cmake_push_check_state (RESET)
set (CMAKE_REQUIRED_LIBRARIES dbghelp)
check_cxx_symbol_exists (UnDecorateSymbolName "windows.h;dbghelp.h" HAVE_DBGHELP)
cmake_pop_check_state ()

if (WITH_FUZZING STREQUAL none)
  # Disable compiler demangler if fuzzing is active; we only want to use the
  # glog demangler then.
  check_cxx_symbol_exists (abi::__cxa_demangle cxxabi.h HAVE___CXA_DEMANGLE)
endif (WITH_FUZZING STREQUAL none)

check_cxx_symbol_exists (__argv cstdlib HAVE___ARGV)
check_cxx_symbol_exists (getprogname cstdlib HAVE_GETPROGNAME)
check_cxx_symbol_exists (program_invocation_short_name cerrno HAVE_PROGRAM_INVOCATION_SHORT_NAME)
check_cxx_source_compiles ([=[
#include <cstdlib>
extern char* __progname;
int main() { return __progname != nullptr ? EXIT_SUCCESS : EXIT_FAILURE; }
]=] HAVE___PROGNAME)

if (WITH_TLS)
  set (GLOG_THREAD_LOCAL_STORAGE 1)
endif (WITH_TLS)

set (_PC_FIELDS
  "uc_mcontext.gregs[REG_PC]"          # Solaris x86 (32 + 64 bit)
  "uc_mcontext.gregs[REG_EIP]"         # Linux (i386)
  "uc_mcontext.gregs[REG_RIP]"         # Linux (x86_64)
  "uc_mcontext.sc_ip"                  # Linux (ia64)
  "uc_mcontext.pc"                     # Linux (mips)
  "uc_mcontext.uc_regs->gregs[PT_NIP]" # Linux (ppc)
  "uc_mcontext.gregs[R15]"             # Linux (arm old [untested])
  "uc_mcontext.arm_pc"                 # Linux (arm arch 5)
  "uc_mcontext.gp_regs[PT_NIP]"        # Suse SLES 11 (ppc64)
  "uc_mcontext.mc_eip"                 # FreeBSD (i386)
  "uc_mcontext.mc_rip"                 # FreeBSD (x86_64 [untested])
  "uc_mcontext.__gregs[_REG_EIP]"      # NetBSD (i386)
  "uc_mcontext.__gregs[_REG_RIP]"      # NetBSD (x86_64)
  "uc_mcontext->ss.eip"                # OS X (i386, <=10.4)
  "uc_mcontext->__ss.__eip"            # OS X (i386, >=10.5)
  "uc_mcontext->ss.rip"                # OS X (x86_64)
  "uc_mcontext->__ss.__rip"            # OS X (>=10.5 [untested])
  "uc_mcontext->ss.srr0"               # OS X (ppc, ppc64 [untested])
  "uc_mcontext->__ss.__srr0"           # OS X (>=10.5 [untested])
)

if (HAVE_UCONTEXT_H AND NOT DEFINED PC_FROM_UCONTEXT)
  cmake_push_check_state (RESET)

  set (CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
  set (_PC_HEADERS ucontext.h signal.h)

  foreach (_PC_FIELD IN LISTS _PC_FIELDS)
    foreach (_PC_HEADER IN LISTS _PC_HEADERS)
      # Replace non-alphanumeric characters by underscores since the name will be
      # used as preprocessor definition.
      string (REGEX REPLACE "[^a-zA-Z0-9]" "_" HAVE_UCONTEXT_FIELD_NAME
        "HAVE_PC_FROM_UCONTEXT_${_PC_FIELD}")
      # Strip trailing underscores for readability
      string (REGEX REPLACE "_+$" "" HAVE_UCONTEXT_FIELD_NAME
        "${HAVE_UCONTEXT_FIELD_NAME}")

      check_struct_has_member (ucontext_t ${_PC_FIELD} ${_PC_HEADER}
        ${HAVE_UCONTEXT_FIELD_NAME} LANGUAGE CXX)

      if (${HAVE_UCONTEXT_FIELD_NAME})
        set (PC_FROM_UCONTEXT ${_PC_FIELD} CACHE STRING
          "<${_PC_HEADER}> ucontext_t PC member")
        mark_as_advanced (PC_FROM_UCONTEXT)
        break ()
      endif (${HAVE_UCONTEXT_FIELD_NAME})
    endforeach (_PC_HEADER)

    if (${HAVE_UCONTEXT_FIELD_NAME})
      break ()
    endif (${HAVE_UCONTEXT_FIELD_NAME})
  endforeach (_PC_FIELD)

  cmake_pop_check_state ()
endif (HAVE_UCONTEXT_H AND NOT DEFINED PC_FROM_UCONTEXT)

if (HAVE_EXECINFO_BACKTRACE AND HAVE_EXECINFO_BACKTRACE_SYMBOLS)
  set (HAVE_STACKTRACE 1)
endif (HAVE_EXECINFO_BACKTRACE AND HAVE_EXECINFO_BACKTRACE_SYMBOLS)

if (WITH_SYMBOLIZE)
  if (WIN32 OR CYGWIN)
    cmake_push_check_state (RESET)
    set (CMAKE_REQUIRED_LIBRARIES DbgHelp)

    check_cxx_source_runs ([=[
    #include <windows.h>
    #include <dbghelp.h>
    #include <cstdlib>

    void foobar() { }

    int main()
    {
        HANDLE process = GetCurrentProcess();

        if (!SymInitialize(process, NULL, TRUE))
            return EXIT_FAILURE;

        char buf[sizeof(SYMBOL_INFO) + MAX_SYM_NAME];
        SYMBOL_INFO *symbol = reinterpret_cast<SYMBOL_INFO *>(buf);
        symbol->SizeOfStruct = sizeof(SYMBOL_INFO);
        symbol->MaxNameLen = MAX_SYM_NAME;

        void* const pc = reinterpret_cast<void*>(&foobar);
        BOOL ret = SymFromAddr(process, reinterpret_cast<DWORD64>(pc), 0, symbol);

        return ret ? EXIT_SUCCESS : EXIT_FAILURE;
    }
    ]=] HAVE_SYMBOLIZE)

    cmake_pop_check_state ()

    if (HAVE_SYMBOLIZE)
      set (HAVE_STACKTRACE 1)
    endif (HAVE_SYMBOLIZE)
  elseif (APPLE AND HAVE_DLADDR)
    set (HAVE_SYMBOLIZE 1)
  elseif (UNIX)
    if (HAVE_ELF_H OR HAVE_SYS_EXEC_ELF_H)
      set (HAVE_SYMBOLIZE 1)
    endif (HAVE_ELF_H OR HAVE_SYS_EXEC_ELF_H)
  endif (WIN32 OR CYGWIN)
endif (WITH_SYMBOLIZE)

# CMake manages symbolize availability. The definition is necessary only when
# building the library.
add_compile_definitions (GLOG_NO_SYMBOLIZE_DETECTION)

check_cxx_symbol_exists (gmtime_r "cstdlib;ctime" HAVE_GMTIME_R)
check_cxx_symbol_exists (localtime_r "cstdlib;ctime" HAVE_LOCALTIME_R)

set (SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P})

# fopen/open on Cygwin can not handle unix-type paths like /home/....
# therefore we translate TEST_SRC_DIR to windows-path.
if (CYGWIN)
  execute_process (COMMAND cygpath.exe -m ${glog_SOURCE_DIR}
                   OUTPUT_STRIP_TRAILING_WHITESPACE
                   OUTPUT_VARIABLE TEST_SRC_DIR)
  set (TEST_SRC_DIR \"${TEST_SRC_DIR}\")
else (CYGWIN)
  set (TEST_SRC_DIR \"${glog_SOURCE_DIR}\")
endif (CYGWIN)

configure_file (src/config.h.cmake.in config.h)

set (_glog_CMake_BINDIR ${CMAKE_INSTALL_BINDIR})
set (_glog_CMake_INCLUDE_DIR ${CMAKE_INSTALL_INCLUDEDIR})
set (_glog_CMake_LIBDIR ${CMAKE_INSTALL_LIBDIR})
set (_glog_CMake_INSTALLDIR ${_glog_CMake_LIBDIR}/cmake/glog)

set (_glog_CMake_DIR glog/cmake)
set (_glog_CMake_DATADIR ${CMAKE_INSTALL_DATAROOTDIR}/${_glog_CMake_DIR})
set (_glog_BINARY_CMake_DATADIR
  ${glog_BINARY_DIR}/${_glog_CMake_DATADIR})

# Add additional CMake find modules here.
set (_glog_CMake_MODULES)

if (Unwind_FOUND)
  # Copy the module only if libunwind is actually used.
  list (APPEND _glog_CMake_MODULES ${glog_SOURCE_DIR}/cmake/FindUnwind.cmake)
endif (Unwind_FOUND)

# Generate file name for each module in the binary directory
foreach (_file ${_glog_CMake_MODULES})
  get_filename_component (_module "${_file}" NAME)

  list (APPEND _glog_BINARY_CMake_MODULES
    ${_glog_BINARY_CMake_DATADIR}/${_module})
endforeach (_file)

if (_glog_CMake_MODULES)
  # Copy modules to binary directory during the build
  add_custom_command (OUTPUT ${_glog_BINARY_CMake_MODULES}
    COMMAND ${CMAKE_COMMAND} -E make_directory
    ${_glog_BINARY_CMake_DATADIR}
    COMMAND ${CMAKE_COMMAND} -E copy ${_glog_CMake_MODULES}
    ${_glog_BINARY_CMake_DATADIR}
    DEPENDS ${_glog_CMake_MODULES}
    COMMENT "Copying find modules..."
  )
endif (_glog_CMake_MODULES)

set (GLOG_PUBLIC_H
  ${glog_BINARY_DIR}/glog/export.h
  src/glog/log_severity.h
  src/glog/logging.h
  src/glog/platform.h
  src/glog/raw_logging.h
  src/glog/stl_logging.h
  src/glog/types.h
  src/glog/flags.h
  src/glog/vlog_is_on.h
)

set (GLOG_SRCS
  ${GLOG_PUBLIC_H}
  src/base/commandlineflags.h
  src/base/googleinit.h
  src/demangle.cc
  src/demangle.h
  src/flags.cc
  src/logging.cc
  src/raw_logging.cc
  src/signalhandler.cc
  src/stacktrace.cc
  src/stacktrace.h
  src/symbolize.cc
  src/symbolize.h
  src/utilities.cc
  src/utilities.h
  src/vlog_is_on.cc
)

# NOTE MSYS2 defines both WIN32 and UNIX. Do not use windows port in this case.
if ((CYGWIN OR WIN32) AND NOT UNIX)
  list (APPEND GLOG_SRCS
    src/windows/port.cc
    src/windows/port.h
  )
  set (_glog_USE_WINDOWS_PORT TRUE)
endif ((CYGWIN OR WIN32) AND NOT UNIX)

add_library (glog_internal OBJECT
  ${_glog_BINARY_CMake_MODULES}
  ${GLOG_SRCS}
)
target_compile_features (glog_internal PUBLIC $<TARGET_PROPERTY:glog,COMPILE_FEATURES>)
set_target_properties (glog_internal PROPERTIES DEFINE_SYMBOL GOOGLE_GLOG_IS_A_DLL)

# Some generators (such as Xcode) do not generate any output if the target does
# not reference at least one source file.
set (_glog_EMPTY_SOURCE ${glog_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/glog.cc)

add_custom_command (
  OUTPUT ${_glog_EMPTY_SOURCE}
  COMMAND ${CMAKE_COMMAND} -E touch ${_glog_EMPTY_SOURCE}
)

add_library (glog
  $<TARGET_OBJECTS:glog_internal>
  ${_glog_EMPTY_SOURCE}
)
target_compile_features (glog PUBLIC cxx_std_14)

add_library (glog::glog ALIAS glog)

set (glog_libraries_options_for_static_linking)

# CMake always uses the generated export header
target_compile_definitions (glog PUBLIC GLOG_USE_GLOG_EXPORT)

if (_glog_USE_WINDOWS_PORT)
  target_compile_definitions (glog PRIVATE GLOG_USE_WINDOWS_PORT)
endif (_glog_USE_WINDOWS_PORT)

unset (_glog_USE_WINDOWS_PORT)

if (WIN32)
  # Do not define min and max as macros
  target_compile_definitions (glog PRIVATE NOMINMAX)
  # Exclude unnecessary funcitonality
  target_compile_definitions (glog PRIVATE WIN32_LEAN_AND_MEAN)
endif (WIN32)

if (HAVE_LIB_GFLAGS)
  target_compile_definitions (glog PUBLIC GLOG_USE_GFLAGS)
endif (HAVE_LIB_GFLAGS)

if (Unwind_FOUND)
  target_link_libraries (glog PRIVATE unwind::unwind)
  set (glog_libraries_options_for_static_linking "${glog_libraries_options_for_static_linking} -lunwind")
  set (Unwind_DEPENDENCY "find_dependency (Unwind ${Unwind_VERSION})")
endif (Unwind_FOUND)

if (HAVE_DBGHELP)
  target_link_libraries (glog PRIVATE dbghelp)
  set (glog_libraries_options_for_static_linking "${glog_libraries_options_for_static_linking} -ldbghelp")
endif (HAVE_DBGHELP)

target_link_libraries (glog PRIVATE Threads::Threads)

if (CMAKE_THREAD_LIBS_INIT)
  set (glog_libraries_options_for_static_linking "${glog_libraries_options_for_static_linking} ${CMAKE_THREAD_LIBS_INIT}")
endif (CMAKE_THREAD_LIBS_INIT)

if (gflags_FOUND)
  # Prefer the gflags target that uses double colon convention
  if (TARGET gflags::gflags)
    target_link_libraries (glog PUBLIC gflags::gflags)
  else (TARGET gflags::gflags)
    target_link_libraries (glog PUBLIC gflags)
  endif (TARGET gflags::gflags)

  set (glog_libraries_options_for_static_linking "${glog_libraries_options_for_static_linking} -lgflags")
endif (gflags_FOUND)

if (ANDROID)
  target_link_libraries (glog PRIVATE log)
  set (glog_libraries_options_for_static_linking "${glog_libraries_options_for_static_linking} -llog")
endif (ANDROID)

set_target_properties (glog PROPERTIES VERSION ${glog_VERSION})
set_target_properties (glog PROPERTIES SOVERSION 3)

if (CYGWIN OR WIN32)
  target_compile_definitions (glog PUBLIC GLOG_NO_ABBREVIATED_SEVERITIES)
endif (CYGWIN OR WIN32)

set_target_properties (glog PROPERTIES PUBLIC_HEADER "${GLOG_PUBLIC_H}")

target_include_directories (glog BEFORE PUBLIC
  "$<BUILD_INTERFACE:${glog_BINARY_DIR}>"
  "$<BUILD_INTERFACE:${glog_SOURCE_DIR}/src>"
  "$<INSTALL_INTERFACE:${_glog_CMake_INCLUDE_DIR}>"
  PRIVATE ${glog_BINARY_DIR}
  PRIVATE ${glog_SOURCE_DIR}/src)

if (CYGWIN OR WIN32)
  target_include_directories (glog_internal PUBLIC
    "$<BUILD_INTERFACE:${glog_SOURCE_DIR}/src/windows>"
    PRIVATE ${glog_SOURCE_DIR}/src/windows)

  target_include_directories (glog PUBLIC
    "$<BUILD_INTERFACE:${glog_SOURCE_DIR}/src/windows>"
    PRIVATE ${glog_SOURCE_DIR}/src/windows)
endif (CYGWIN OR WIN32)

set_target_properties (glog PROPERTIES DEFINE_SYMBOL GOOGLE_GLOG_IS_A_DLL)

target_include_directories (glog_internal PUBLIC
  $<TARGET_PROPERTY:glog,INCLUDE_DIRECTORIES>)
target_compile_definitions (glog_internal PUBLIC
  $<TARGET_PROPERTY:glog,COMPILE_DEFINITIONS>
  PRIVATE GOOGLE_GLOG_IS_A_DLL)

generate_export_header (glog
  EXPORT_MACRO_NAME GLOG_EXPORT
  EXPORT_FILE_NAME ${glog_BINARY_DIR}/glog/export.h)

string (STRIP "${glog_libraries_options_for_static_linking}" glog_libraries_options_for_static_linking)

if (WITH_PKGCONFIG)
  set (VERSION ${glog_VERSION})
  set (prefix ${CMAKE_INSTALL_PREFIX})
  set (exec_prefix ${CMAKE_INSTALL_FULL_BINDIR})
  set (libdir ${CMAKE_INSTALL_FULL_LIBDIR})
  set (includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR})

  configure_file (
    "${glog_SOURCE_DIR}/libglog.pc.in"
    "${glog_BINARY_DIR}/libglog.pc"
    @ONLY
  )

  unset (VERSION)
  unset (prefix)
  unset (exec_prefix)
  unset (libdir)
  unset (includedir)
endif (WITH_PKGCONFIG)

# Unit testing

if (NOT WITH_FUZZING STREQUAL "none")
  add_executable (fuzz_demangle
    src/fuzz_demangle.cc
  )

  if (WITH_FUZZING STREQUAL "ossfuzz")
    set (LIB_FUZZING_ENGINE $ENV{LIB_FUZZING_ENGINE})
    target_link_libraries (fuzz_demangle PRIVATE glog ${LIB_FUZZING_ENGINE})
  elseif (WITH_FUZZING STREQUAL "libfuzzer")
    target_compile_options (fuzz_demangle PRIVATE -fsanitize=fuzzer)
    target_link_libraries (fuzz_demangle PRIVATE glog)
  else (WITH_FUZZING STREQUAL "libfuzzer")
    message (FATAL_ERROR "Unsupported fuzzing engine ${WITH_FUZZING}")
  endif (WITH_FUZZING STREQUAL "ossfuzz")
endif (NOT WITH_FUZZING STREQUAL "none")

if (BUILD_TESTING)
  add_library (glog_test INTERFACE)
  target_link_libraries (glog_test INTERFACE $<TARGET_OBJECTS:glog_internal> $<TARGET_PROPERTY:glog,LINK_LIBRARIES>)
  target_compile_definitions (glog_test INTERFACE GLOG_STATIC_DEFINE $<TARGET_PROPERTY:glog,COMPILE_DEFINITIONS>)
  target_include_directories (glog_test INTERFACE $<TARGET_PROPERTY:glog,INCLUDE_DIRECTORIES>)

  if (HAVE_LIB_GTEST)
    target_link_libraries (glog_test INTERFACE GTest::gtest)
  endif (HAVE_LIB_GTEST)

  if (HAVE_LIB_GMOCK)
    target_link_libraries (glog_test INTERFACE GTest::gmock)
  endif (HAVE_LIB_GMOCK)

  add_executable (logging_unittest
    src/logging_unittest.cc
  )

  target_link_libraries (logging_unittest PRIVATE glog_test)

  add_executable (stl_logging_unittest
    src/stl_logging_unittest.cc
  )

  target_link_libraries (stl_logging_unittest PRIVATE glog_test)

  if (HAVE_SYMBOLIZE)
    add_executable (symbolize_unittest
      src/symbolize_unittest.cc
    )

    target_link_libraries (symbolize_unittest PRIVATE glog_test)
  endif (HAVE_SYMBOLIZE)

  add_executable (demangle_unittest
    src/demangle_unittest.cc
  )

  target_link_libraries (demangle_unittest PRIVATE glog_test)

  add_test (NAME demangle COMMAND demangle_unittest)

  if (HAVE___CXA_DEMANGLE)
    # Demangle tests use a different (reduced) representation of symbols
    set_tests_properties (demangle PROPERTIES DISABLED ON)
  endif (HAVE___CXA_DEMANGLE)

  if (HAVE_STACKTRACE)
    add_executable (stacktrace_unittest
      src/stacktrace_unittest.cc
    )

    target_link_libraries (stacktrace_unittest PRIVATE glog_test)
  endif (HAVE_STACKTRACE)

  add_executable (utilities_unittest
    src/utilities_unittest.cc
  )

  target_link_libraries (utilities_unittest PRIVATE glog_test)

  if (HAVE_STACKTRACE AND HAVE_SYMBOLIZE)
    add_executable (signalhandler_unittest
      src/signalhandler_unittest.cc
    )

    target_link_libraries (signalhandler_unittest PRIVATE glog_test)
  endif (HAVE_STACKTRACE AND HAVE_SYMBOLIZE)

  add_test (NAME logging COMMAND logging_unittest)

  set_tests_properties (logging PROPERTIES TIMEOUT 30)
  # MacOS diff is not deterministic: use the output to determine whether the
  # test passed.
  set_tests_properties (logging PROPERTIES PASS_REGULAR_EXPRESSION ".*\nPASS\n.*")

  # FIXME: Skip flaky test
  set_tests_properties (logging PROPERTIES SKIP_REGULAR_EXPRESSION
    "Check failed: time_ns within LogTimes::LOG_PERIOD_TOL_NS of LogTimes::LOG_PERIOD_NS")

  if (APPLE)
    # FIXME: Skip flaky test
    set_property (TEST logging APPEND PROPERTY SKIP_REGULAR_EXPRESSION
      "unexpected new.*PASS\nTest with golden file failed. We'll try to show the diff:")
  endif (APPLE)

  if (TARGET signalhandler_unittest)
    add_test (NAME signalhandler COMMAND signalhandler_unittest)
  endif (TARGET signalhandler_unittest)

  if (TARGET stacktrace_unittest)
    add_test (NAME stacktrace COMMAND stacktrace_unittest)
    set_tests_properties (stacktrace PROPERTIES TIMEOUT 30)
  endif (TARGET stacktrace_unittest)

  add_test (NAME stl_logging COMMAND stl_logging_unittest)

  if (TARGET symbolize_unittest)
    add_test (NAME symbolize COMMAND symbolize_unittest)

    # FIXME: Skip flaky test when compiled in C++20 mode
    set_tests_properties (symbolize PROPERTIES SKIP_REGULAR_EXPRESSION
      [=[Check failed: streq\("nonstatic_func"\, TrySymbolize\(\(void \*\)\(&nonstatic_func\)\)\)]=])
  endif (TARGET symbolize_unittest)

  if (HAVE_LIB_GMOCK)
    add_executable (mock-log_unittest
      src/mock-log_unittest.cc
      src/mock-log.h
    )

    target_link_libraries (mock-log_unittest PRIVATE glog_test)

    add_test (NAME mock-log COMMAND mock-log_unittest)
  endif (HAVE_LIB_GMOCK)

  # Generate an initial cache

  get_cache_variables (_CACHEVARS)

  set (_INITIAL_CACHE
    ${glog_BINARY_DIR}/test_package_config/glog_package_config_initial_cache.cmake)

  # Package config test

  add_test (NAME cmake_package_config_init COMMAND ${CMAKE_COMMAND}
    -DTEST_BINARY_DIR=${glog_BINARY_DIR}/test_package_config
    -DINITIAL_CACHE=${_INITIAL_CACHE}
    -DCACHEVARS=${_CACHEVARS}
    -P ${glog_SOURCE_DIR}/cmake/TestInitPackageConfig.cmake
  )

  add_test (NAME cmake_package_config_generate COMMAND ${CMAKE_COMMAND}
    -DGENERATOR=${CMAKE_GENERATOR}
    -DGENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM}
    -DGENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET}
    -DINITIAL_CACHE=${_INITIAL_CACHE}
    -DPACKAGE_DIR=${glog_BINARY_DIR}
    -DPATH=$ENV{PATH}
    -DSOURCE_DIR=${glog_SOURCE_DIR}/src/package_config_unittest/working_config
    -DTEST_BINARY_DIR=${glog_BINARY_DIR}/test_package_config/working_config
    -P ${glog_SOURCE_DIR}/cmake/TestPackageConfig.cmake
  )

  add_test (NAME cmake_package_config_build COMMAND
    ${CMAKE_COMMAND} --build ${glog_BINARY_DIR}/test_package_config/working_config
                     --config $<CONFIG>
  )

  add_test (NAME cmake_package_config_cleanup COMMAND ${CMAKE_COMMAND} -E
    remove_directory
    ${glog_BINARY_DIR}/test_package_config
  )

  # Fixtures setup
  set_tests_properties (cmake_package_config_init PROPERTIES FIXTURES_SETUP
    cmake_package_config)
  set_tests_properties (cmake_package_config_generate PROPERTIES FIXTURES_SETUP
    cmake_package_config_working)

  # Fixtures cleanup
  set_tests_properties (cmake_package_config_cleanup PROPERTIES FIXTURES_CLEANUP
    cmake_package_config)

  # Fixture requirements
  set_tests_properties (cmake_package_config_generate PROPERTIES
    FIXTURES_REQUIRED cmake_package_config)
  set_tests_properties (cmake_package_config_build PROPERTIES
    FIXTURES_REQUIRED "cmake_package_config;cmake_package_config_working")

  add_executable (cleanup_immediately_unittest
    src/cleanup_immediately_unittest.cc)

  target_link_libraries (cleanup_immediately_unittest PRIVATE glog_test)

  add_executable (cleanup_with_absolute_prefix_unittest
    src/cleanup_with_absolute_prefix_unittest.cc)

  target_link_libraries (cleanup_with_absolute_prefix_unittest PRIVATE glog_test)

  add_executable (cleanup_with_relative_prefix_unittest
    src/cleanup_with_relative_prefix_unittest.cc)

  target_link_libraries (cleanup_with_relative_prefix_unittest PRIVATE glog_test)

  set (CLEANUP_LOG_DIR ${glog_BINARY_DIR}/cleanup_tests)

  add_test (NAME cleanup_init COMMAND
    ${CMAKE_COMMAND} -E make_directory ${CLEANUP_LOG_DIR})
  add_test (NAME cleanup_logdir COMMAND
    ${CMAKE_COMMAND} -E remove_directory ${CLEANUP_LOG_DIR})
  add_test (NAME cleanup_immediately COMMAND
    ${CMAKE_COMMAND}
    -DLOGCLEANUP=$<TARGET_FILE:cleanup_immediately_unittest>
    # NOTE The trailing slash is important
    -DTEST_DIR=${CLEANUP_LOG_DIR}/
    -P ${glog_SOURCE_DIR}/cmake/RunCleanerTest1.cmake
    WORKING_DIRECTORY ${glog_BINARY_DIR})
  add_test (NAME cleanup_with_absolute_prefix COMMAND
    ${CMAKE_COMMAND}
    -DLOGCLEANUP=$<TARGET_FILE:cleanup_with_absolute_prefix_unittest>
    -DTEST_DIR=${glog_BINARY_DIR}/
    -P ${glog_SOURCE_DIR}/cmake/RunCleanerTest2.cmake
    WORKING_DIRECTORY ${glog_BINARY_DIR})
  add_test (NAME cleanup_with_relative_prefix COMMAND
    ${CMAKE_COMMAND}
    -DLOGCLEANUP=$<TARGET_FILE:cleanup_with_relative_prefix_unittest>
    -DTEST_DIR=${glog_BINARY_DIR}/
    -DTEST_SUBDIR=test_subdir/
    -P ${glog_SOURCE_DIR}/cmake/RunCleanerTest3.cmake
    WORKING_DIRECTORY ${glog_BINARY_DIR})

  # Fixtures setup
  set_tests_properties (cleanup_init PROPERTIES FIXTURES_SETUP logcleanuptest)
  ## Fixtures cleanup
  set_tests_properties (cleanup_logdir PROPERTIES FIXTURES_CLEANUP logcleanuptest)
  # Fixture requirements
  set_tests_properties (cleanup_immediately PROPERTIES FIXTURES_REQUIRED logcleanuptest)
  set_tests_properties (cleanup_with_absolute_prefix PROPERTIES FIXTURES_REQUIRED logcleanuptest)
  set_tests_properties (cleanup_with_relative_prefix PROPERTIES FIXTURES_REQUIRED logcleanuptest)

  add_executable (striplog0_unittest
    src/striplog_unittest.cc
  )
  target_compile_definitions (striplog0_unittest PRIVATE GOOGLE_STRIP_LOG=0)
  target_link_libraries (striplog0_unittest PRIVATE glog_test)

  add_test (NAME striplog0 COMMAND striplog0_unittest)

  add_executable (striplog2_unittest
    src/striplog_unittest.cc
  )
  target_compile_definitions (striplog2_unittest PRIVATE GOOGLE_STRIP_LOG=2)
  target_link_libraries (striplog2_unittest PRIVATE glog_test)

  add_test (NAME striplog2 COMMAND striplog2_unittest)

  add_executable (striplog10_unittest
    src/striplog_unittest.cc
  )
  target_compile_definitions (striplog10_unittest PRIVATE GOOGLE_STRIP_LOG=10)
  target_link_libraries (striplog10_unittest PRIVATE glog_test)

  add_test (NAME striplog10 COMMAND striplog10_unittest)

  set_tests_properties (
    striplog0
    striplog2
    striplog10
    PROPERTIES WILL_FAIL ON
  )

  add_test (NAME log_severity_constants COMMAND ${CMAKE_CTEST_COMMAND}
    --build-config $<CONFIG>
    --build-and-test
    "${glog_SOURCE_DIR}/src/log_severity_unittest"
    "${glog_BINARY_DIR}/Tests/log_severity_constants"
    --build-generator ${CMAKE_GENERATOR}
    --build-makeprogram ${CMAKE_MAKE_PROGRAM}
    --build-target glog_log_severity_constants
    --build-options
    -DCMAKE_BUILD_TYPE=$<CONFIG>
    -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
    -DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM}
    -DCMAKE_GENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET}
    -Dglog_DIR=${glog_BINARY_DIR}
  )
  set_tests_properties (log_severity_constants PROPERTIES
    PASS_REGULAR_EXPRESSION "COMPACT_GOOGLE_LOG_[1-3]"
  )

  add_test (NAME log_severity_conversion COMMAND ${CMAKE_CTEST_COMMAND}
    --build-config $<CONFIG>
    --build-and-test
    "${glog_SOURCE_DIR}/src/log_severity_unittest"
    "${glog_BINARY_DIR}/Tests/log_severity_conversion"
    --build-generator ${CMAKE_GENERATOR}
    --build-makeprogram ${CMAKE_MAKE_PROGRAM}
    --build-target glog_log_severity_conversion
    --build-options
    -DCMAKE_BUILD_TYPE=$<CONFIG>
    -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
    -DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM}
    -DCMAKE_GENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET}
    -Dglog_DIR=${glog_BINARY_DIR}
  )

  if (CMAKE_COMPILER_IS_GNUCXX)
    set_tests_properties (log_severity_conversion PROPERTIES
      PASS_REGULAR_EXPRESSION "error: invalid conversion from (‘|')int(’|')"
    )
  elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang)
    set_tests_properties (log_severity_conversion PROPERTIES
      PASS_REGULAR_EXPRESSION "no known conversion from 'int'"
    )
  elseif (MSVC)
    set_tests_properties (log_severity_conversion PROPERTIES
      PASS_REGULAR_EXPRESSION "error C2440"
    )
  else (CMAKE_COMPILER_IS_GNUCXX)
    message (AUTHOR_WARNING
      "Unsupported C++ compiler ${CMAKE_CXX_COMPILER_ID}: "
      "log_severity_conversion test will be disabled"
    )
    set_tests_properties (log_severity_conversion DISABLED ON)
  endif (CMAKE_COMPILER_IS_GNUCXX)

  add_test (NAME includes_logging COMMAND ${CMAKE_CTEST_COMMAND}
    --build-config $<CONFIG>
    --build-and-test
    "${glog_SOURCE_DIR}/src/includes_unittest"
    "${glog_BINARY_DIR}/Tests/includes_logging"
    --build-generator ${CMAKE_GENERATOR}
    --build-makeprogram ${CMAKE_MAKE_PROGRAM}
    --build-target glog_includes_logging
    --build-options
    -DCMAKE_BUILD_TYPE=$<CONFIG>
    -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
    -DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM}
    -DCMAKE_GENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET}
    -Dglog_DIR=${glog_BINARY_DIR}
  )

  add_test (NAME includes_vlog_is_on COMMAND ${CMAKE_CTEST_COMMAND}
    --build-config $<CONFIG>
    --build-and-test
    "${glog_SOURCE_DIR}/src/includes_unittest"
    "${glog_BINARY_DIR}/Tests/includes_vlog_is_on"
    --build-generator ${CMAKE_GENERATOR}
    --build-makeprogram ${CMAKE_MAKE_PROGRAM}
    --build-target glog_includes_vlog_is_on
    --build-options
    -DCMAKE_BUILD_TYPE=$<CONFIG>
    -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
    -DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM}
    -DCMAKE_GENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET}
    -Dglog_DIR=${glog_BINARY_DIR}
  )

  add_test (NAME includes_raw_logging COMMAND ${CMAKE_CTEST_COMMAND}
    --build-config $<CONFIG>
    --build-and-test
    "${glog_SOURCE_DIR}/src/includes_unittest"
    "${glog_BINARY_DIR}/Tests/includes_raw_logging"
    --build-generator ${CMAKE_GENERATOR}
    --build-makeprogram ${CMAKE_MAKE_PROGRAM}
    --build-target glog_includes_raw_logging
    --build-options
    -DCMAKE_BUILD_TYPE=$<CONFIG>
    -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
    -DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM}
    -DCMAKE_GENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET}
    -Dglog_DIR=${glog_BINARY_DIR}
  )

  add_test (NAME includes_stl_logging COMMAND ${CMAKE_CTEST_COMMAND}
    --build-config $<CONFIG>
    --build-and-test
    "${glog_SOURCE_DIR}/src/includes_unittest"
    "${glog_BINARY_DIR}/Tests/includes_stl_logging"
    --build-generator ${CMAKE_GENERATOR}
    --build-makeprogram ${CMAKE_MAKE_PROGRAM}
    --build-target glog_includes_stl_logging
    --build-options
    -DCMAKE_BUILD_TYPE=$<CONFIG>
    -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
    -DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM}
    -DCMAKE_GENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET}
    -Dglog_DIR=${glog_BINARY_DIR}
  )

  add_test (NAME dcheck_on COMMAND ${CMAKE_CTEST_COMMAND}
    --build-config Debug
    --build-and-test
    "${glog_SOURCE_DIR}/src/dcheck_unittest"
    "${glog_BINARY_DIR}/Tests/dcheck_on"
    --build-generator ${CMAKE_GENERATOR}
    --build-generator-platform "${CMAKE_GENERATOR_PLATFORM}"
    --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}"
    --build-makeprogram ${CMAKE_MAKE_PROGRAM}
    --build-target glog_dcheck
    --build-options
    -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
    -DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON
    -Dglog_DIR=${glog_BINARY_DIR}
    --test-command glog_dcheck
  )
  set_tests_properties (dcheck_on PROPERTIES
    DISABLED $<NOT:$<CONFIG:Debug,RelWithDebInfo>>
    ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<TARGET_FILE_DIR:glog>"
    PASS_REGULAR_EXPRESSION "Assert failed: false"
  )

  add_test (NAME dcheck_off COMMAND ${CMAKE_CTEST_COMMAND}
    --build-config Release
    --build-and-test
    "${glog_SOURCE_DIR}/src/dcheck_unittest"
    "${glog_BINARY_DIR}/Tests/dcheck_off"
    --build-generator ${CMAKE_GENERATOR}
    --build-generator-platform "${CMAKE_GENERATOR_PLATFORM}"
    --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}"
    --build-makeprogram ${CMAKE_MAKE_PROGRAM}
    --build-target glog_dcheck
    --build-options
    -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
    -DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON
    -Dglog_DIR=${glog_BINARY_DIR}
    --test-command glog_dcheck
  )
  # There should be no output
  set_tests_properties (dcheck_off PROPERTIES
    DISABLED $<NOT:$<CONFIG:Release,MinSizeRel>>
    ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<TARGET_FILE_DIR:glog>"
    PASS_REGULAR_EXPRESSION ""
  )
endif (BUILD_TESTING)

if (BUILD_EXAMPLES)
  add_executable (custom_sink_example examples/custom_sink.cc)
  target_link_libraries (custom_sink_example PRIVATE glog::glog)
endif (BUILD_EXAMPLES)

install (TARGETS glog
  EXPORT glog-targets
  RUNTIME DESTINATION ${_glog_CMake_BINDIR}
  PUBLIC_HEADER DESTINATION ${_glog_CMake_INCLUDE_DIR}/glog
  LIBRARY DESTINATION ${_glog_CMake_LIBDIR}
  ARCHIVE DESTINATION ${_glog_CMake_LIBDIR})

if (WITH_PKGCONFIG)
  install (
    FILES "${glog_BINARY_DIR}/libglog.pc"
    DESTINATION "${_glog_CMake_LIBDIR}/pkgconfig"
  )
endif (WITH_PKGCONFIG)

set (glog_CMake_VERSION 3.0)

if (gflags_FOUND)
  # Ensure clients locate only the package config and not third party find
  # modules having the same name. This avoid cmake_policy PUSH/POP errors.
  if (CMAKE_VERSION VERSION_LESS 3.9)
    set (gflags_DEPENDENCY "find_dependency (gflags ${gflags_VERSION})")
  else (CMAKE_VERSION VERSION_LESS 3.9)
    # Passing additional find_package arguments to find_dependency is possible
    # starting with CMake 3.9.
    set (glog_CMake_VERSION 3.9)
    set (gflags_DEPENDENCY "find_dependency (gflags ${gflags_VERSION} NO_MODULE)")
  endif (CMAKE_VERSION VERSION_LESS 3.9)
endif (gflags_FOUND)

configure_package_config_file (glog-config.cmake.in
  ${glog_BINARY_DIR}/glog-config.cmake
  INSTALL_DESTINATION ${_glog_CMake_INSTALLDIR}
  NO_CHECK_REQUIRED_COMPONENTS_MACRO)

write_basic_package_version_file (
  ${glog_BINARY_DIR}/glog-config-version.cmake
  COMPATIBILITY SameMajorVersion)

export (TARGETS glog NAMESPACE glog:: FILE glog-targets.cmake)
export (PACKAGE glog)

get_filename_component (_PREFIX "${CMAKE_INSTALL_PREFIX}" ABSOLUTE)

# Directory containing the find modules relative to the config install
# directory.
file (RELATIVE_PATH glog_REL_CMake_MODULES
  ${_PREFIX}/${_glog_CMake_INSTALLDIR}
  ${_PREFIX}/${_glog_CMake_DATADIR}/glog-modules.cmake)

get_filename_component (glog_REL_CMake_DATADIR ${glog_REL_CMake_MODULES}
  DIRECTORY)

set (glog_FULL_CMake_DATADIR
  ${glog_BINARY_DIR}/${_glog_CMake_DATADIR})

configure_file (glog-modules.cmake.in
  ${glog_BINARY_DIR}/glog-modules.cmake @ONLY)

install (CODE
"
set (glog_FULL_CMake_DATADIR \"\\\${CMAKE_CURRENT_LIST_DIR}/${glog_REL_CMake_DATADIR}\")
set (glog_DATADIR_DESTINATION ${_glog_CMake_INSTALLDIR})

if (NOT IS_ABSOLUTE ${_glog_CMake_INSTALLDIR})
  set (glog_DATADIR_DESTINATION \"\${CMAKE_INSTALL_PREFIX}/\${glog_DATADIR_DESTINATION}\")
endif (NOT IS_ABSOLUTE ${_glog_CMake_INSTALLDIR})

configure_file (\"${glog_SOURCE_DIR}/glog-modules.cmake.in\"
  \"${glog_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/glog-modules.cmake\" @ONLY)
file (INSTALL
  \"${glog_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/glog-modules.cmake\"
  DESTINATION
  \"\${glog_DATADIR_DESTINATION}\")
"
  COMPONENT Development
)

install (FILES
  ${glog_BINARY_DIR}/glog-config.cmake
  ${glog_BINARY_DIR}/glog-config-version.cmake
  DESTINATION ${_glog_CMake_INSTALLDIR})

# Find modules in share/glog/cmake
install (DIRECTORY ${_glog_BINARY_CMake_DATADIR}
  DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/glog
  COMPONENT Development
  FILES_MATCHING PATTERN "*.cmake"
)

install (EXPORT glog-targets NAMESPACE glog:: DESTINATION
  ${_glog_CMake_INSTALLDIR})


================================================
FILE: CONTRIBUTORS
================================================
# People who have agreed to one of the CLAs and can contribute patches.
# The AUTHORS file lists the copyright holders; this file
# lists people.  For example, Google employees are listed here
# but not in AUTHORS, because Google holds the copyright.
#
# Names should be added to this file only after verifying that
# the individual or the individual's organization has agreed to
# the appropriate Contributor License Agreement, found here:
#
# https://developers.google.com/open-source/cla/individual
# https://developers.google.com/open-source/cla/corporate
#
# The agreement for individuals can be filled out on the web.
#
# When adding J Random Contributor's name to this file,
# either J's name or J's organization's name should be
# added to the AUTHORS file, depending on whether the
# individual or corporate CLA was used.
#
# Names should be added to this file as:
#     Name <email address>
#
# Please keep the list sorted.

Abhishek Dasgupta <abhi2743@gmail.com>
Abhishek Parmar <abhishek@orng.net>
Andrew Schwartzmeyer <andrew@schwartzmeyer.com>
Andy Ying <andy@trailofbits.com>
Bret McKee <bretmckee@google.com>
Brian Silverman <bsilver16384@gmail.com>
Dmitriy Arbitman <d.arbitman@gmail.com>
Eric Kilmer <eric.d.kilmer@gmail.com>
Fumitoshi Ukai <ukai@google.com>
Guillaume Dumont <dumont.guillaume@gmail.com>
Håkan L. S. Younes <hyounes@google.com>
Ivan Penkov <ivanpe@google.com>
Jacob Trimble <modmaker@google.com>
Jim Ray <jimray@google.com>
LingBin <lingbinlb@gmail.com>
Marco Wang <m.aesophor@gmail.com>
Michael Darr <mdarr@matician.com>
Michael Tanner <michael@tannertaxpro.com>
MiniLight <MiniLightAR@Gmail.com>
Peter Collingbourne <pcc@google.com>
Rodrigo Queiro <rodrigoq@google.com>
romange <romange@users.noreply.github.com>
Roman Perepelitsa <roman.perepelitsa@gmail.com>
Sergiu Deitsch <sergiu.deitsch@gmail.com>
Shinichiro Hamaji <hamaji@google.com>
tbennun <tbennun@gmail.com>
Teddy Reed <teddy@prosauce.org>
Vijaymahantesh Sattigeri <vijaymahantesh016@gmail.com>
Zhongming Qu <qzmfranklin@gmail.com>
Zhuoran Shen <cmsflash99@gmail.com>


================================================
FILE: ChangeLog
================================================
2024-06-08  Google Inc. <opensource@google.com>

	* google-glog: version 0.7.1.
	* See git log for the details.

2024-02-17  Google Inc. <opensource@google.com>

	* google-glog: version 0.7.0.
	* See git log for the details.

2022-04-05  Google Inc. <opensource@google.com>

	* google-glog: version 0.6.0.
	* See git log for the details.

2021-05-08  Google Inc. <opensource@google.com>

	* google-glog: version 0.5.0.
	* See git log for the details.

2019-01-22  Google Inc. <opensource@google.com>

	* google-glog: version 0.4.0.
	* See git log for the details.

2017-05-09  Google Inc. <opensource@google.com>

	* google-glog: version 0.3.5
	* See git log for the details.

2015-03-09  Google Inc. <opensource@google.com>

	* google-glog: version 0.3.4
	* See git log for the details.

2013-02-01  Google Inc. <opensource@google.com>

	* google-glog: version 0.3.3
	* Add --disable-rtti option for configure.
	* Visual Studio build and test fix.
	* QNX build fix (thanks vanuan).
	* Reduce warnings.
	* Fixed LOG_SYSRESULT (thanks ukai).
	* FreeBSD build fix (thanks yyanagisawa).
	* Clang build fix.
	* Now users can re-initialize glog after ShutdownGoogleLogging.
	* Color output support by GLOG_colorlogtostderr (thanks alexs).
	* Now glog's ABI around flags are compatible with gflags.
	* Document mentions how to modify flags from user programs.

2012-01-12  Google Inc. <opensource@google.com>

	* google-glog: version 0.3.2
	* Clang support.
	* Demangler and stacktrace improvement for newer GCCs.
	* Now fork(2) doesn't mess up log files.
	* Make valgrind happier.
	* Reduce warnings for more -W options.
	* Provide a workaround for ERROR defined by windows.h.

2010-06-15  Google Inc. <opensource@google.com>

	* google-glog: version 0.3.1
	* GLOG_* environment variables now work even when gflags is installed.
	* Snow leopard support.
	* Now we can build and test from out side tree.
	* Add DCHECK_NOTNULL.
	* Add ShutdownGoogleLogging to close syslog (thanks DGunchev)
	* Fix --enable-frame-pointers option (thanks kazuki.ohta)
	* Fix libunwind detection (thanks giantchen)

2009-07-30  Google Inc. <opensource@google.com>

	* google-glog: version 0.3.0
	* Fix a deadlock happened when user uses glog with recent gflags.
	* Suppress several unnecessary warnings (thanks keir).
	* NetBSD and OpenBSD support.
	* Use Win32API GetComputeNameA properly (thanks magila).
	* Fix user name detection for Windows (thanks ademin).
	* Fix several minor bugs.

2009-04-10  Google Inc. <opensource@google.com>
	* google-glog: version 0.2.1
	* Fix timestamps of VC++ version.
	* Add pkg-config support (thanks Tomasz)
	* Fix build problem when building with gtest (thanks Michael)
	* Add --with-gflags option for configure (thanks Michael)
	* Fixes for GCC 4.4 (thanks John)

2009-01-23  Google Inc. <opensource@google.com>
	* google-glog: version 0.2
	* Add initial Windows VC++ support.
	* Google testing/mocking frameworks integration.
	* Link pthread library automatically.
	* Flush logs in signal handlers.
	* Add macros LOG_TO_STRING, LOG_AT_LEVEL, DVLOG, and LOG_TO_SINK_ONLY.
	* Log microseconds.
	* Add --log_backtrace_at option.
	* Fix some minor bugs.

2008-11-18  Google Inc. <opensource@google.com>
	* google-glog: version 0.1.2
	* Add InstallFailureSignalHandler(). (satorux)
	* Re-organize the way to produce stacktraces.
	* Don't define unnecessary macro DISALLOW_EVIL_CONSTRUCTORS.

2008-10-15  Google Inc. <opensource@google.com>
	* google-glog: version 0.1.1
	* Support symbolize for MacOSX 10.5.
	* BUG FIX: --vmodule didn't work with gflags.
	* BUG FIX: symbolize_unittest failed with GCC 4.3.
	* Several fixes on the document.

2008-10-07  Google Inc. <opensource@google.com>

	* google-glog: initial release:
	The glog package contains a library that implements application-level
	logging.  This library provides logging APIs based on C++-style
	streams and various helper macros.


================================================
FILE: LICENSE.md
================================================
Copyright © 2024, Google Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright notice, this
  list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this
  list of conditions and the following disclaimer in the documentation and/or
  other materials provided with the distribution.
* Neither the name of Google Inc. nor the names of its contributors may be used
  to endorse or promote products derived from this software without specific
  prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


================================================
FILE: MODULE.bazel
================================================
module(
    name = "glog",
    compatibility_level = 1,
)

bazel_dep(name = "gflags", version = "2.2.2")
bazel_dep(name = "googletest", version = "1.14.0", dev_dependency = True)
bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "rules_cc", version = "0.0.12")

# Required for Windows clang-cl build: --extra_toolchains=@local_config_cc//:cc-toolchain-arm64_windows
cc_configure = use_extension("@rules_cc//cc:extensions.bzl", "cc_configure_extension")
use_repo(cc_configure, "local_config_cc")


================================================
FILE: README.rst
================================================
Google Logging Library
======================

**Deprecation notice**: This project is no longer maintained and will be archived on 2025-06-30.
Consider using
`ng-log <https://github.com/ng-log/ng-log>`_ (API-compatible,
community-maintained,
`migration instructions <https://github.com/ng-log/ng-log/blob/master/docs/build.md>`_)
or
`Abseil Logging <https://abseil.io/docs/cpp/guides/logging>`_
(Google-maintained) instead. Thank you for all the contributions!

Google Logging (glog) was a C++14 library that implements application-level
logging. The library provided logging APIs based on C++-style streams and
various helper macros.

Getting Started
---------------

Please refer to project's `documentation <https://google.github.io/glog/>`_.


================================================
FILE: WORKSPACE.bazel
================================================
# WORKSPACE marker file needed by Bazel


================================================
FILE: bazel/example/BUILD.bazel
================================================
cc_test(
    name = "main",
    size = "small",
    srcs = ["main.cc"],
    deps = [
        "//:glog",
        "@gflags//:gflags",
    ],
)


================================================
FILE: bazel/example/main.cc
================================================
#include <gflags/gflags.h>
#include <glog/logging.h>
#include <glog/stl_logging.h>

int main(int argc, char* argv[]) {
  // Initialize Google's logging library.
  google::InitGoogleLogging(argv[0]);

  // Optional: parse command line flags
  gflags::ParseCommandLineFlags(&argc, &argv, true);

  LOG(INFO) << "Hello, world!";

  // glog/stl_logging.h allows logging STL containers.
  std::vector<int> x;
  x.push_back(1);
  x.push_back(2);
  x.push_back(3);
  LOG(INFO) << "ABC, it's easy as " << x;

  return 0;
}


================================================
FILE: bazel/glog.bzl
================================================
# Implement a macro glog_library() that the BUILD.bazel file can load.

# By default, glog is built with gflags support.  You can change this behavior
# by using glog_library(with_gflags=0)
#
# This file is inspired by the following sample BUILD files:
#       https://github.com/google/glog/issues/61
#       https://github.com/google/glog/files/393474/BUILD.txt
#
# Known issue: the namespace parameter is not supported on Win32.

def expand_template_impl(ctx):
    ctx.actions.expand_template(
        template = ctx.file.template,
        output = ctx.outputs.out,
        substitutions = ctx.attr.substitutions,
    )

expand_template = rule(
    implementation = expand_template_impl,
    attrs = {
        "template": attr.label(mandatory = True, allow_single_file = True),
        "substitutions": attr.string_dict(mandatory = True),
        "out": attr.output(mandatory = True),
    },
)

def glog_library(with_gflags = 1, **kwargs):
    if native.repository_name() != "@":
        repo_name = native.repository_name()[1:]  # Strip the first leading @
        gendir = "$(GENDIR)/external/" + repo_name
        src_windows = "external/%s/src/windows" % repo_name
    else:
        gendir = "$(GENDIR)"
        src_windows = "src/windows"

    # Config setting for WebAssembly target.
    native.config_setting(
        name = "wasm",
        values = {"cpu": "wasm"},
    )

    # Detect when building with clang-cl on Windows.
    native.config_setting(
        name = "clang-cl",
        values = {"compiler": "clang-cl"},
    )

    common_copts = [
        "-std=c++14",
        "-I%s/glog_internal" % gendir,
    ] + (["-DGLOG_USE_GFLAGS"] if with_gflags else [])

    wasm_copts = [
        # Disable warnings that exists in glog.
        "-Wno-sign-compare",
        "-Wno-unused-function",
        "-Wno-unused-local-typedefs",
        "-Wno-unused-variable",
        # Allows src/logging.cc to determine the host name.
        "-DHAVE_SYS_UTSNAME_H",
        # For src/utilities.cc.
        "-DHAVE_SYS_TIME_H",
        # NOTE: users could optionally patch -DHAVE_UNWIND off if
        # stacktrace dumping is not needed
        "-DHAVE_UNWIND",
        # Enable dumping stacktrace upon sigaction.
        "-DHAVE_SIGACTION",
        # For logging.cc.
        "-DHAVE_PREAD",
        # -DHAVE_MODE_T prevent repeated typedef mode_t leading
        # to emcc compilation failure
        "-DHAVE_MODE_T",
        "-DHAVE_UNISTD_H",
    ]

    linux_or_darwin_copts = wasm_copts + [
        "-DGLOG_EXPORT=__attribute__((visibility(\\\"default\\\")))",
        "-DGLOG_NO_EXPORT=__attribute__((visibility(\\\"default\\\")))",
        "-DHAVE_POSIX_FADVISE",
        "-DHAVE_SSIZE_T",
        "-DHAVE_SYS_TYPES_H",
        # For src/utilities.cc.
        "-DHAVE_SYS_SYSCALL_H",
        # For src/logging.cc to create symlinks.
        "-fvisibility-inlines-hidden",
        "-fvisibility=hidden",
    ]

    freebsd_only_copts = [
        # Enable declaration of _Unwind_Backtrace
        "-D_GNU_SOURCE",
        "-DHAVE_LINK_H",
        "-DHAVE_SYMBOLIZE",  # Supported by <link.h>
    ]

    linux_only_copts = [
        # For utilities.h.
        "-DHAVE_EXECINFO_H",
        "-DHAVE_LINK_H",
        "-DHAVE_SYMBOLIZE",  # Supported by <link.h>
    ]

    darwin_only_copts = [
        # For stacktrace.
        "-DHAVE_DLADDR",
    ]

    windows_only_copts = [
        # Override -DGLOG_EXPORT= from the cc_library's defines.
        "-DGLOG_EXPORT=__declspec(dllexport)",
        "-DGLOG_NO_ABBREVIATED_SEVERITIES",
        "-DGLOG_NO_EXPORT=",
        "-DGLOG_USE_WINDOWS_PORT",
        "-DHAVE__CHSIZE_S",
        "-DHAVE_DBGHELP",
        "-I" + src_windows,
    ]

    clang_cl_only_copts = [
        # Allow the override of -DGLOG_EXPORT.
        "-Wno-macro-redefined",
    ]

    windows_only_srcs = [
        "src/windows/dirent.h",
        "src/windows/port.cc",
        "src/windows/port.h",
    ]

    gflags_deps = ["@gflags//:gflags"] if with_gflags else []

    final_lib_defines = select({
        # GLOG_EXPORT is normally set by export.h, but that's not
        # generated for Bazel.
        "@bazel_tools//src/conditions:windows": [
            "GLOG_DEPRECATED=__declspec(deprecated)",
            "GLOG_EXPORT=",
            "GLOG_NO_ABBREVIATED_SEVERITIES",
            "GLOG_NO_EXPORT=",
        ],
        "//conditions:default": [
            "GLOG_DEPRECATED=__attribute__((deprecated))",
            "GLOG_EXPORT=__attribute__((visibility(\\\"default\\\")))",
            "GLOG_NO_EXPORT=__attribute__((visibility(\\\"default\\\")))",
        ],
    })

    final_lib_copts = select({
        "@bazel_tools//src/conditions:windows": common_copts + windows_only_copts,
        "@bazel_tools//src/conditions:darwin": common_copts + linux_or_darwin_copts + darwin_only_copts,
        "@bazel_tools//src/conditions:freebsd": common_copts + linux_or_darwin_copts + freebsd_only_copts,
        ":wasm": common_copts + wasm_copts,
        "//conditions:default": common_copts + linux_or_darwin_copts + linux_only_copts,
    }) + select({
        ":clang-cl": clang_cl_only_copts,
        "//conditions:default": [],
    })

    # Needed to use these headers in `glog` and the test targets without exposing them as public targets in `glog`
    native.filegroup(
        name = "shared_headers",
        srcs = [
            "src/base/commandlineflags.h",
            "src/stacktrace.h",
            "src/utilities.h",
        ]
    )

    native.cc_library(
        name = "glog",
        visibility = ["//visibility:public"],
        srcs = [
            ":config_h",
            ":shared_headers",
            "src/base/googleinit.h",
            "src/demangle.cc",
            "src/demangle.h",
            "src/flags.cc",
            "src/logging.cc",
            "src/raw_logging.cc",
            "src/signalhandler.cc",
            "src/stacktrace.cc",
            "src/stacktrace.h",
            "src/stacktrace_generic-inl.h",
            "src/stacktrace_libunwind-inl.h",
            "src/stacktrace_powerpc-inl.h",
            "src/stacktrace_unwind-inl.h",
            "src/stacktrace_windows-inl.h",
            "src/stacktrace_x86-inl.h",
            "src/symbolize.cc",
            "src/symbolize.h",
            "src/utilities.cc",
            "src/utilities.h",
            "src/vlog_is_on.cc",
        ] + select({
            "@bazel_tools//src/conditions:windows": windows_only_srcs,
            "//conditions:default": [],
        }),
        hdrs = [
            "src/glog/flags.h",
            "src/glog/log_severity.h",
            "src/glog/logging.h",
            "src/glog/platform.h",
            "src/glog/raw_logging.h",
            "src/glog/stl_logging.h",
            "src/glog/types.h",
            "src/glog/vlog_is_on.h",
        ],
        # https://github.com/google/glog/issues/837: Replacing
        # `strip_include_prefix` with `includes` would avoid spamming
        # downstream projects with compiler warnings, but would also leak
        # private headers like stacktrace.h, because strip_include_prefix's
        # implementation only creates symlinks for the public hdrs. I suspect
        # the only way to avoid this is to refactor the project including the
        # CMake build, so that the private headers are in a glog_internal
        # subdirectory.
        strip_include_prefix = "src",
        defines = final_lib_defines,
        copts = final_lib_copts,
        deps = gflags_deps + select({
            "@bazel_tools//src/conditions:windows": [":strip_include_prefix_hack"],
            "//conditions:default": [],
        }),
        linkopts = select({
            "@bazel_tools//src/conditions:windows": ["dbghelp.lib"],
            "//conditions:default": [],
        }),
        **kwargs
    )

    test_list = [
        "cleanup_immediately",
        "cleanup_with_absolute_prefix",
        "cleanup_with_relative_prefix",
        # "demangle", # Broken
        # "logging", # Broken
        # "mock-log", # Broken
        # "signalhandler", # Pointless
        "stacktrace",
        "stl_logging",
        # "symbolize", # Broken
        "utilities",
    ]

    test_only_copts = [
        "-DTEST_SRC_DIR=\\\"%s/tests\\\"" % gendir,
    ]

    for test_name in test_list:
        native.cc_test(
            name = test_name + "_test",
            visibility = ["//visibility:public"],
            srcs = [
                ":config_h",
                ":shared_headers",
                "src/googletest.h",
                "src/" + test_name + "_unittest.cc",
            ],
            defines = final_lib_defines,
            copts = final_lib_copts + test_only_copts,
            deps = gflags_deps + [
                ":glog",
                "@googletest//:gtest",
            ],
            **kwargs
        )

    # Workaround https://github.com/bazelbuild/bazel/issues/6337 by declaring
    # the dependencies without strip_include_prefix.
    native.cc_library(
        name = "strip_include_prefix_hack",
        hdrs = [
            "src/glog/flags.h",
            "src/glog/log_severity.h",
            "src/glog/logging.h",
            "src/glog/platform.h",
            "src/glog/raw_logging.h",
            "src/glog/stl_logging.h",
            "src/glog/types.h",
            "src/glog/vlog_is_on.h",
        ],
    )

    expand_template(
        name = "config_h",
        template = "src/config.h.cmake.in",
        out = "glog_internal/config.h",
        substitutions = {"#cmakedefine": "//cmakedefine"},
    )


================================================
FILE: cmake/DetermineGflagsNamespace.cmake
================================================
macro(determine_gflags_namespace VARIABLE)
  if (NOT DEFINED "${VARIABLE}")
    if (CMAKE_REQUIRED_INCLUDES)
      set (CHECK_INCLUDE_FILE_CXX_INCLUDE_DIRS "-DINCLUDE_DIRECTORIES=${CMAKE_REQUIRED_INCLUDES}")
    else ()
      set (CHECK_INCLUDE_FILE_CXX_INCLUDE_DIRS)
    endif ()

    set(MACRO_CHECK_INCLUDE_FILE_FLAGS ${CMAKE_REQUIRED_FLAGS})

    set(_NAMESPACES gflags google)
    set(_check_code
"
#include <gflags/gflags.h>

int main(int argc, char**argv)
{
  GLOG_GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true);
}
")
    if (NOT CMAKE_REQUIRED_QUIET)
      message (STATUS "Looking for gflags namespace")
    endif ()
    if (${ARGC} EQUAL 3)
      set (CMAKE_CXX_FLAGS_SAVE ${CMAKE_CXX_FLAGS})
      set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARGV2}")
    endif ()

    set (_check_file
        ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/DetermineGflagsNamespace.cxx)

    foreach (_namespace ${_NAMESPACES})
      file (WRITE "${_check_file}" "${_check_code}")
      try_compile (${VARIABLE}
        "${CMAKE_BINARY_DIR}" "${_check_file}"
        COMPILE_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}" -DGLOG_GFLAGS_NAMESPACE=${_namespace}
        LINK_LIBRARIES gflags
        CMAKE_FLAGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
        OUTPUT_VARIABLE OUTPUT)

      if (${VARIABLE})
        set (${VARIABLE} ${_namespace} CACHE INTERNAL "gflags namespace" FORCE)
        break ()
      else ()
        file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
          "Determining the gflags namespace ${_namespace} failed with the following output:\n"
          "${OUTPUT}\n\n")
      endif ()
    endforeach (_namespace)

    if (${ARGC} EQUAL 3)
      set (CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS_SAVE})
    endif ()

    if (${VARIABLE})
      if (NOT CMAKE_REQUIRED_QUIET)
        message (STATUS "Looking for gflags namespace - ${${VARIABLE}}")
      endif ()
      file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
        "Determining the gflags namespace passed with the following output:\n"
        "${OUTPUT}\n\n")
    else ()
      if (NOT CMAKE_REQUIRED_QUIET)
        message (STATUS "Looking for gflags namespace - failed")
      endif ()
      set (${VARIABLE} ${_namespace} CACHE INTERNAL "gflags namespace")
    endif ()
  endif ()
endmacro ()


================================================
FILE: cmake/FindUnwind.cmake
================================================
# - Try to find libunwind
# Once done this will define
#
#  Unwind_FOUND - system has libunwind
#  unwind::unwind - cmake target for libunwind

include (FindPackageHandleStandardArgs)

find_path (Unwind_INCLUDE_DIR NAMES unwind.h libunwind.h DOC "unwind include directory")
find_library (Unwind_LIBRARY NAMES unwind DOC "unwind library")

mark_as_advanced (Unwind_INCLUDE_DIR Unwind_LIBRARY)

# Extract version information
if (Unwind_LIBRARY)
  set (_Unwind_VERSION_HEADER ${Unwind_INCLUDE_DIR}/libunwind-common.h)

  if (EXISTS ${_Unwind_VERSION_HEADER})
    file (READ ${_Unwind_VERSION_HEADER} _Unwind_VERSION_CONTENTS)

    string (REGEX REPLACE ".*#define UNW_VERSION_MAJOR[ \t]+([0-9]+).*" "\\1"
      Unwind_VERSION_MAJOR "${_Unwind_VERSION_CONTENTS}")
    string (REGEX REPLACE ".*#define UNW_VERSION_MINOR[ \t]+([0-9]+).*" "\\1"
      Unwind_VERSION_MINOR "${_Unwind_VERSION_CONTENTS}")
    string (REGEX REPLACE ".*#define UNW_VERSION_EXTRA[ \t]+([0-9]+).*" "\\1"
      Unwind_VERSION_PATCH "${_Unwind_VERSION_CONTENTS}")

    set (Unwind_VERSION ${Unwind_VERSION_MAJOR}.${Unwind_VERSION_MINOR})

    if (CMAKE_MATCH_0)
      # Third version component may be empty
      set (Unwind_VERSION ${Unwind_VERSION}.${Unwind_VERSION_PATCH})
      set (Unwind_VERSION_COMPONENTS 3)
    else (CMAKE_MATCH_0)
      set (Unwind_VERSION_COMPONENTS 2)
    endif (CMAKE_MATCH_0)
  endif (EXISTS ${_Unwind_VERSION_HEADER})
endif (Unwind_LIBRARY)

# handle the QUIETLY and REQUIRED arguments and set Unwind_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args (Unwind
  REQUIRED_VARS Unwind_INCLUDE_DIR Unwind_LIBRARY
  VERSION_VAR Unwind_VERSION
)

if (Unwind_FOUND)
  if (NOT TARGET unwind::unwind)
    add_library (unwind::unwind INTERFACE IMPORTED)

    set_property (TARGET unwind::unwind PROPERTY
      INTERFACE_INCLUDE_DIRECTORIES ${Unwind_INCLUDE_DIR}
    )
    set_property (TARGET unwind::unwind PROPERTY
      INTERFACE_LINK_LIBRARIES ${Unwind_LIBRARY}
    )
    set_property (TARGET unwind::unwind PROPERTY
      IMPORTED_CONFIGURATIONS RELEASE
    )
  endif (NOT TARGET unwind::unwind)
endif (Unwind_FOUND)


================================================
FILE: cmake/GetCacheVariables.cmake
================================================
cmake_policy (PUSH)
cmake_policy (VERSION 3.16...3.27)

include (CMakeParseArguments)

function (get_cache_variables _CACHEVARS)
  set (_SINGLE)
  set (_MULTI EXCLUDE)
  set (_OPTIONS)

  cmake_parse_arguments (_ARGS "${_OPTIONS}" "${_SINGLE}" "${_MULTI}" ${ARGS} ${ARGN})

  get_cmake_property (_VARIABLES VARIABLES)

  set (CACHEVARS)

  foreach (_VAR ${_VARIABLES})
    if (DEFINED _ARGS_EXCLUDE)
      if ("${_VAR}" IN_LIST _ARGS_EXCLUDE)
        continue ()
      endif ("${_VAR}" IN_LIST _ARGS_EXCLUDE)
    endif (DEFINED _ARGS_EXCLUDE)

    get_property (_CACHEVARTYPE CACHE ${_VAR} PROPERTY TYPE)

    if ("${_CACHEVARTYPE}" STREQUAL INTERNAL OR
        "${_CACHEVARTYPE}" STREQUAL STATIC OR
        "${_CACHEVARTYPE}" STREQUAL UNINITIALIZED)
        continue ()
    endif ("${_CACHEVARTYPE}" STREQUAL INTERNAL OR
        "${_CACHEVARTYPE}" STREQUAL STATIC OR
        "${_CACHEVARTYPE}" STREQUAL UNINITIALIZED)

    get_property (_CACHEVARVAL CACHE ${_VAR} PROPERTY VALUE)

    if ("${_CACHEVARVAL}" STREQUAL "")
      continue ()
    endif ("${_CACHEVARVAL}" STREQUAL "")

    get_property (_CACHEVARDOC CACHE ${_VAR} PROPERTY HELPSTRING)

    # Escape " in values
    string (REPLACE "\"" "\\\"" _CACHEVARVAL "${_CACHEVARVAL}")
    # Escape " in help strings
    string (REPLACE "\"" "\\\"" _CACHEVARDOC "${_CACHEVARDOC}")
    # Escape ; in values
    string (REPLACE ";" "\\\;" _CACHEVARVAL "${_CACHEVARVAL}")
    # Escape ; in help strings
    string (REPLACE ";" "\\\;" _CACHEVARDOC "${_CACHEVARDOC}")
    # Escape backslashes in values except those that are followed by a
    # quote.
    string (REGEX REPLACE "\\\\([^\"])" "\\\\\\1" _CACHEVARVAL "${_CACHEVARVAL}")
    # Escape backslashes in values that are followed by a letter to avoid
    # invalid escape sequence errors.
    string (REGEX REPLACE "\\\\([a-zA-Z])" "\\\\\\\\1" _CACHEVARVAL "${_CACHEVARVAL}")
    string (REPLACE "\\\\" "\\\\\\\\" _CACHEVARDOC "${_CACHEVARDOC}")

    if (NOT "${_CACHEVARTYPE}" STREQUAL BOOL)
      set (_CACHEVARVAL "\"${_CACHEVARVAL}\"")
    endif (NOT "${_CACHEVARTYPE}" STREQUAL BOOL)

    if (NOT "${_CACHEVARTYPE}" STREQUAL "" AND NOT "${_CACHEVARVAL}" STREQUAL "")
      set (CACHEVARS "${CACHEVARS}set (${_VAR} ${_CACHEVARVAL} CACHE ${_CACHEVARTYPE} \"${_CACHEVARDOC}\")\n")
    endif (NOT "${_CACHEVARTYPE}" STREQUAL "" AND NOT "${_CACHEVARVAL}" STREQUAL "")
  endforeach (_VAR)

  set (${_CACHEVARS} ${CACHEVARS} PARENT_SCOPE)
endfunction (get_cache_variables)

cmake_policy (POP)


================================================
FILE: cmake/RunCleanerTest1.cmake
================================================
set (RUNS 3)

foreach (iter RANGE 1 ${RUNS})
  set (ENV{GOOGLE_LOG_DIR} ${TEST_DIR})
  execute_process (COMMAND ${LOGCLEANUP} RESULT_VARIABLE _RESULT)

  if (NOT _RESULT EQUAL 0)
    message (FATAL_ERROR "Failed to run logcleanup_unittest (error: ${_RESULT})")
  endif (NOT _RESULT EQUAL 0)
endforeach (iter)

file (GLOB LOG_FILES ${TEST_DIR}/*.foobar)
list (LENGTH LOG_FILES NUM_FILES)

if (WIN32)
  # On Windows open files cannot be removed and will result in a permission
  # denied error while unlinking such file. Therefore, the last file will be
  # retained.
  set (_expected 1)
 else (WIN32)
  set (_expected 0)
endif (WIN32)

if (NOT NUM_FILES EQUAL _expected)
  message (SEND_ERROR "Expected ${_expected} log file in log directory but found ${NUM_FILES}")
endif (NOT NUM_FILES EQUAL _expected)


================================================
FILE: cmake/RunCleanerTest2.cmake
================================================
set (RUNS 3)

foreach (iter RANGE 1 ${RUNS})
  execute_process (COMMAND ${LOGCLEANUP} -log_dir=${TEST_DIR}
    RESULT_VARIABLE _RESULT)

  if (NOT _RESULT EQUAL 0)
    message (FATAL_ERROR "Failed to run logcleanup_unittest (error: ${_RESULT})")
  endif (NOT _RESULT EQUAL 0)
endforeach (iter)

file (GLOB LOG_FILES ${TEST_DIR}/test_cleanup_*.barfoo)
list (LENGTH LOG_FILES NUM_FILES)

if (WIN32)
  # On Windows open files cannot be removed and will result in a permission
  # denied error while unlinking such file. Therefore, the last file will be
  # retained.
  set (_expected 1)
 else (WIN32)
  set (_expected 0)
endif (WIN32)

if (NOT NUM_FILES EQUAL _expected)
  message (SEND_ERROR "Expected ${_expected} log file in log directory but found ${NUM_FILES}")
endif (NOT NUM_FILES EQUAL _expected)


================================================
FILE: cmake/RunCleanerTest3.cmake
================================================
set (RUNS 3)

# Create the subdirectory required by this unit test.
file (MAKE_DIRECTORY ${TEST_DIR}/${TEST_SUBDIR})

foreach (iter RANGE 1 ${RUNS})
  execute_process (COMMAND ${LOGCLEANUP} -log_dir=${TEST_DIR}
    RESULT_VARIABLE _RESULT)

  if (NOT _RESULT EQUAL 0)
    message (FATAL_ERROR "Failed to run logcleanup_unittest (error: ${_RESULT})")
  endif (NOT _RESULT EQUAL 0)
endforeach (iter)

file (GLOB LOG_FILES ${TEST_DIR}/${TEST_SUBDIR}/test_cleanup_*.relativefoo)
list (LENGTH LOG_FILES NUM_FILES)

if (WIN32)
  # On Windows open files cannot be removed and will result in a permission
  # denied error while unlinking such file. Therefore, the last file will be
  # retained.
  set (_expected 1)
 else (WIN32)
  set (_expected 0)
endif (WIN32)

if (NOT NUM_FILES EQUAL _expected)
  message (SEND_ERROR "Expected ${_expected} log file in build directory ${TEST_DIR}${TEST_SUBDIR} but found ${NUM_FILES}")
endif (NOT NUM_FILES EQUAL _expected)

# Remove the subdirectory required by this unit test.
file (REMOVE_RECURSE ${TEST_DIR}/${TEST_SUBDIR})


================================================
FILE: cmake/TestInitPackageConfig.cmake
================================================
# Create the build directory
execute_process (
  COMMAND ${CMAKE_COMMAND} -E make_directory ${TEST_BINARY_DIR}
  RESULT_VARIABLE _DIRECTORY_CREATED_SUCCEEDED
)

if (NOT _DIRECTORY_CREATED_SUCCEEDED EQUAL 0)
  message (FATAL_ERROR "Failed to create build directory")
endif (NOT _DIRECTORY_CREATED_SUCCEEDED EQUAL 0)

file (WRITE ${INITIAL_CACHE} "${CACHEVARS}")


================================================
FILE: cmake/TestPackageConfig.cmake
================================================
if (GENERATOR_TOOLSET)
  list (APPEND _ADDITIONAL_ARGS -T ${GENERATOR_TOOLSET})
endif (GENERATOR_TOOLSET)

if (GENERATOR_PLATFORM)
  list (APPEND _ADDITIONAL_ARGS -A ${GENERATOR_PLATFORM})
endif (GENERATOR_PLATFORM)

# Run CMake
execute_process (
  # Capture the PATH environment variable content set during project generation
  # stage. This is required because later during the build stage the PATH is
  # modified again (e.g., for MinGW AppVeyor CI builds) by adding back the
  # directory containing git.exe. Incidentally, the Git installation directory
  # also contains sh.exe which causes MinGW Makefile generation to fail.
  COMMAND ${CMAKE_COMMAND} -E env PATH=${PATH}
  ${CMAKE_COMMAND} -C ${INITIAL_CACHE}
    -G ${GENERATOR}
    ${_ADDITIONAL_ARGS}
    -DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON
    -DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON
    -Dglog_ROOT=${PACKAGE_DIR}
    -S ${SOURCE_DIR}
    -B ${TEST_BINARY_DIR}
  RESULT_VARIABLE _GENERATE_SUCCEEDED
)

if (NOT _GENERATE_SUCCEEDED EQUAL 0)
  message (FATAL_ERROR "Failed to generate project files using CMake")
endif (NOT _GENERATE_SUCCEEDED EQUAL 0)


================================================
FILE: codecov.yml
================================================
comment:
  layout: "diff, flags, files"
  behavior: default
  require_changes: false
  require_base: false
  require_head: true
ignore:
  - "**/*_unittest.cc"
  - "src/*_unittest/**"
  - "src/googletest.h"
  - "src/mock-log.h"


================================================
FILE: docs/build.md
================================================
# Building from Source

## Bazel

To use glog within a project which uses the [Bazel](https://bazel.build/) build
tool, add the following lines to your `MODULE.bazel` file:

``` bazel title="MODULE.bazel"
bazel_dep(name = "glog")

archive_override(
    module_name = "glog",
    urls = "https://github.com/google/glog/archive/cc0de6c200375b33d907ee7632eee2f173b33a09.tar.gz",
    strip_prefix = "glog-cc0de6c200375b33d907ee7632eee2f173b33a09",  # Latest commit as of 2024-06-08.
    integrity = "sha256-rUrv4EBkdc+4Wbhfxp+KoRstlj2Iw842/OpLfDq0ivg=",
)
```

You can then add `@glog//:glog` to
the deps section of a `cc_binary` or
`cc_library` rule, and `#!cpp #include <glog/logging.h>` to
include it in your source code.

!!! example "Using glog in a Bazel project"
    ``` bazel
    cc_binary(
        name = "main",
        srcs = ["main.cc"],
        deps = ["@glog//:glog"],
    )
    ```

## CMake

glog can be compiled using [CMake](http://www.cmake.org) on a wide range of
platforms. The typical workflow for building glog on a Unix-like system with GNU
Make as build tool is as follows:

1.  Clone the repository and change into source directory.
  ``` bash
  git clone https://github.com/google/glog.git
  cd glog
  ```
2.  Run CMake to configure the build tree.
  ``` bash
  cmake -S . -B build -G "Unix Makefiles"
  ```
  CMake provides different generators, and by default will pick the most
  relevant one to your environment. If you need a specific version of Visual
  Studio, use `#!bash cmake . -G <generator-name>`, and see `#!bash cmake
  --help` for the available generators. Also see `-T <toolset-name>`, which can
  be used to request the native x64 toolchain with `-T host=x64`.
3.  Afterwards, generated files can be used to compile the project.
  ``` bash
  cmake --build build
  ```
4.  Test the build software (optional).
  ``` bash
  cmake --build build --target test
  ```
5.  Install the built files (optional).
  ``` bash
  cmake --build build --target install
  ```

Once successfully built, glog can be [integrated into own projects](usage.md).


================================================
FILE: docs/contribute.md
================================================
# How to Contribute

We'd love to accept your patches and contributions to this project.
There are a just a few small guidelines you need to follow.

## Contributor License Agreement (CLA)

Contributions to any Google project must be accompanied by a Contributor
License Agreement. This is not a copyright **assignment**, it simply
gives Google permission to use and redistribute your contributions as
part of the project.

-   If you are an individual writing original source code and you're
    sure you own the intellectual property, then you'll need to sign an
    [individual
    CLA](https://developers.google.com/open-source/cla/individual).
-   If you work for a company that wants to allow you to contribute your
    work, then you'll need to sign a [corporate
    CLA](https://developers.google.com/open-source/cla/corporate).

You generally only need to submit a CLA once, so if you've already
submitted one (even if it was for a different project), you probably
don't need to do it again.

Once your CLA is submitted (or if you already submitted one for another Google
project), make a commit adding yourself to the
[AUTHORS](https://github.com/google/glog/blob/master/AUTHORS) and
[CONTRIBUTORS](https://github.com/google/glog/blob/master/CONTRIBUTORS) files.
This commit can be part of your first [pull
request](https://help.github.com/articles/creating-a-pull-request).

## Submitting a Patch

1.  It's generally best to start by opening a new issue describing the
    bug or feature you're intending to fix. Even if you think it's
    relatively minor, it's helpful to know what people are working on.
    Mention in the initial issue that you are planning to work on that
    bug or feature so that it can be assigned to you.
2.  Follow the normal process of
    [forking](https://help.github.com/articles/fork-a-repo) the project,
    and setup a new branch to work in. It's important that each group of
    changes be done in separate branches in order to ensure that a pull
    request only includes the commits related to that bug or feature.
3.  Do your best to have [well-formed commit
    messages](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
    for each change. This provides consistency throughout the project,
    and ensures that commit messages are able to be formatted properly
    by various git tools.
4.  Finally, push the commits to your fork and submit a [pull
    request](https://help.github.com/articles/creating-a-pull-request).


================================================
FILE: docs/failures.md
================================================
# Failure Signal Handler

## Stacktrace as Default Failure Handler

The library provides a convenient signal handler that will dump useful
information when the program crashes on certain signals such as `SIGSEGV`. The
signal handler can be installed by `#!cpp
google::InstallFailureSignalHandler()`. The following is an example of output
from the signal handler.

    *** Aborted at 1225095260 (unix time) try "date -d @1225095260" if you are using GNU date ***
    *** SIGSEGV (@0x0) received by PID 17711 (TID 0x7f893090a6f0) from PID 0; stack trace: ***
    PC: @           0x412eb1 TestWaitingLogSink::send()
        @     0x7f892fb417d0 (unknown)
        @           0x412eb1 TestWaitingLogSink::send()
        @     0x7f89304f7f06 google::LogMessage::SendToLog()
        @     0x7f89304f35af google::LogMessage::Flush()
        @     0x7f89304f3739 google::LogMessage::~LogMessage()
        @           0x408cf4 TestLogSinkWaitTillSent()
        @           0x4115de main
        @     0x7f892f7ef1c4 (unknown)
        @           0x4046f9 (unknown)


## Customizing Handler Output

By default, the signal handler writes the failure dump to the standard error.
However, it is possible to customize the destination by installing a callback
using the `#!cpp google::InstallFailureWriter()` function. The function expects
a pointer to a function with the following signature:

``` cpp
void YourFailureWriter(const char* message/* (1)! */, std::size_t length/* (2)! */);
```

1. The pointer references the start of the failure message.

    !!! danger
        The string is **not null-terminated**.

2. The message length in characters.

!!! warning "Possible overflow errors"
    Users should not expect the `message` string to be null-terminated.

## User-defined Failure Function

`FATAL` severity level messages or unsatisfied `CHECK` condition
terminate your program. You can change the behavior of the termination
by `google::InstallFailureFunction`.

``` cpp
void YourFailureFunction() {
  // Reports something...
  exit(EXIT_FAILURE);
}

int main(int argc, char* argv[]) {
  google::InstallFailureFunction(&YourFailureFunction);
}
```

By default, glog tries to dump the stacktrace and calls `#!cpp std::abort`. The
stacktrace is generated only when running the application on a system
supported[^1] by glog.

[^1]: To extract the stack trace, glog currently supports the following targets:

    * x86, x86_64,
    * PowerPC architectures,
    * `libunwind`,
    * and the Debug Help Library (`dbghelp`) on Windows.



================================================
FILE: docs/flags.md
================================================
# Adjusting Output

Several flags influence glog's output behavior.

## Using Command-line Parameters and Environment Variables

If the [Google gflags
library](https://github.com/gflags/gflags) is installed on your machine,
the build system will automatically detect and use it, allowing you to
pass flags on the command line.

!!! example "Activate `--logtostderr` in an application from the command line"
    A binary `you_application` that uses glog can be started using
    ``` bash
    ./your_application --logtostderr=1
    ```
    to log to `stderr` instead of writing the output to a log file.

!!! tip
    You can set boolean flags to `true` by specifying `1`, `true`, or `yes`. To
    set boolean flags to `false`, specify `0`, `false`, or `no`. In either case
    the spelling is case-insensitive.


If the Google gflags library isn't installed, you set flags via
environment variables, prefixing the flag name with `GLOG_`, e.g.,

!!! example "Activate `logtostderr` without gflags"
    ``` bash
    GLOG_logtostderr=1 ./your_application
    ```

The following flags are most commonly used:

`logtostderr` (`bool`, default=`false`)

:   Log messages to `stderr` instead of logfiles.

`stderrthreshold` (`int`, default=2, which is `ERROR`)

:   Copy log messages at or above this level to `stderr` in addition to
    logfiles. The numbers of severity levels `INFO`, `WARNING`, `ERROR`,
    and `FATAL` are 0, 1, 2, and 3, respectively.

`minloglevel` (`int`, default=0, which is `INFO`)

:   Log messages at or above this level. Again, the numbers of severity
    levels `INFO`, `WARNING`, `ERROR`, and `FATAL` are 0, 1, 2, and 3,
    respectively.

`log_dir` (`string`, default="")

:   If specified, logfiles are written into this directory instead of
    the default logging directory.

`v` (`int`, default=0)

:   Show all `#!cpp VLOG(m)` messages for `m` less or equal the value of this
    flag. Overridable by `#!bash --vmodule`. Refer to [verbose
    logging](logging.md#verbose-logging) for more detail.

`vmodule` (`string`, default="")

:   Per-module verbose level. The argument has to contain a
    comma-separated list of `<module name>=<log level>`. `<module name>` is a
    glob pattern (e.g., `gfs*` for all modules whose name starts with "gfs"),
    matched against the filename base (that is, name ignoring .cc/.h./-inl.h).
    `<log level>` overrides any value given by `--v`. See also [verbose
    logging](logging.md#verbose-logging) for more details.

Additional flags are defined in
[flags.cc](https://github.com/google/glog/blob/master/src/flags.cc). Please see
the source for their complete list.

## Modifying Flags Programmatically

You can also modify flag values in your program by modifying global variables
`FLAGS_*`. Most settings start working immediately after you update `FLAGS_*`.
The exceptions are the flags related to destination files. For instance, you
might want to set `FLAGS_log_dir` before calling `google::InitGoogleLogging`.

!!! example "Setting `log_dir` at runtime"
    ``` cpp
    LOG(INFO) << "file";
    // Most flags work immediately after updating values.
    FLAGS_logtostderr = 1;
    LOG(INFO) << "stderr";
    FLAGS_logtostderr = 0;
    // This won’t change the log destination. If you want to set this
    // value, you should do this before google::InitGoogleLogging .
    FLAGS_log_dir = "/some/log/directory";
    LOG(INFO) << "the same file";
    ```


================================================
FILE: docs/index.md
================================================
# Google Logging Library

Google Logging (glog) is a C++14 library that implements application-level
logging. The library provides logging APIs based on C++-style streams and
various helper macros.

# How to Use

You can log a message by simply streaming things to `LOG`(<a particular
[severity level](logging.md#severity-levels)\>), e.g.,

``` cpp title="main.cpp"
#include <glog/logging.h>

int main(int argc, char* argv[]) {
    google::InitGoogleLogging(argv[0]); // (1)!
    LOG(INFO) << "Found " << num_cookies << " cookies"; // (2)!
}
```

1. Initialize the Google Logging Library
2. Log a message with informational severity

The library can be installed using various [package managers](packages.md) or
compiled [from source](build.md). For a detailed overview of glog features and
their usage, please refer to the [user guide](logging.md).

!!! warning
    The above example requires further [Bazel](build.md#bazel) or
    [CMake](usage.md) setup for use in own projects.


================================================
FILE: docs/license.md
================================================
# The 3-Clause BSD License

--8<-- "LICENSE.md"


================================================
FILE: docs/log_cleaner.md
================================================
# Automatically Remove Old Logs

To enable the log cleaner:

``` cpp
using namespace std::chrono_literals;
google::EnableLogCleaner(24h * 3); // keep your logs for 3 days
```

In C++20 (and later) this can be shortened to:

``` cpp
using namespace std::chrono_literals;
google::EnableLogCleaner(3d); // keep your logs for 3 days
```

And then glog will check if there are overdue logs whenever a flush is
performed. In this example, any log file from your project whose last
modified time is greater than 3 days will be `unlink`()ed.

This feature can be disabled at any time (if it has been enabled) using
``` cpp
google::DisableLogCleaner();
```


================================================
FILE: docs/log_stripping.md
================================================
# Strip Logging Messages

Strings used in log messages can increase the size of your binary and
present a privacy concern. You can therefore instruct glog to remove all
strings which fall below a certain severity level by using the
`GOOGLE_STRIP_LOG` macro:

If your application has code like this:

``` cpp
#define GOOGLE_STRIP_LOG 1    // this must go before the #include!
#include <glog/logging.h>
```

The compiler will remove the log messages whose severities are less than
the specified integer value. Since `VLOG` logs at the severity level
`INFO` (numeric value `0`), setting `GOOGLE_STRIP_LOG` to 1 or greater
removes all log messages associated with `VLOG`s as well as `INFO` log
statements.



================================================
FILE: docs/logging.md
================================================
# Logging

glog defines a series of macros that simplify many common logging tasks. You can
log messages by [severity level](#severity-levels), [control logging](flags.md)
behavior from the command line, log based on
[conditionals](#conditional-occasional-logging), abort the program when
[expected conditions](#runtime-checks) are not met, introduce your [own logging
levels](#verbose-logging), [customize the prefix](#format-customization)
attached to log messages, and more.


## Severity Levels

You can specify one of the following severity levels (in increasing order of
severity):

1.  `INFO`,
2.  `WARNING`,
3.  `ERROR`, and
4.  `FATAL`.

Logging a `FATAL` message terminates the program (after the message is logged).

!!! note
    Messages of a given severity are logged not only to corresponding severity
    logfile but also to other logfiles of lower severity. For instance, a
    message of severity `FATAL` will be logged to logfiles of severity `FATAL`,
    `ERROR`, `WARNING`, and `INFO`.

The `DFATAL` severity logs a `FATAL` error in [debug mode](#debugging-support)
(i.e., there is no `NDEBUG` macro defined), but avoids halting the program in
production by automatically reducing the severity to `ERROR`.

## Log Files

Unless otherwise specified, glog uses the format

    <tmp>/<program name>.<hostname>.<user name>.log.<severity level>.<date>-<time>.<pid>

for log filenames written to a directory designated as `<tmp>` and
determined according to the following rules.

**Windows**

:   glog uses the
    [GetTempPathA](https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettemppatha)
    API function to retrieve the directory for temporary files with a
    fallback to

    1.  `C:\TMP\`
    2.  `C:\TEMP\`

    (in the order given.)

**non-Windows**

:   The directory is determined by referencing the environment variables

    1.  `TMPDIR`
    2.  `TMP`

    if set with a fallback to `/tmp/`.

The default path to a log file on Linux, for instance, could be

    /tmp/hello_world.example.com.hamaji.log.INFO.20080709-222411.10474

By default, glog echos `ERROR` and `FATAL` messages to standard error in
addition to log files.

## Log Line Prefix Format

Log lines have this form:

    Lyyyymmdd hh:mm:ss.uuuuuu threadid file:line] msg...

where the fields are defined as follows:

  | Placeholder         | Meaning                                                               |
  | ------------------- | ----------------------------------------------------------------------|
  | `L`                 | A single character, representing the log level (e.g., `I` for `INFO`) |
  | `yyyy`              | The year                                                              |
  | `mm`                | The month (zero padded; i.e., May is `05`)                            |
  | `dd`                | The day (zero padded)                                                 |
  | `hh:mm:ss.uuuuuu`   | Time in hours, minutes and fractional seconds                         |
  | `threadid`          | The space-padded thread ID                                            |
  | `file`              | The file name                                                         |
  | `line`              | The line number                                                       |
  | `msg`               | The user-supplied message                                             |

!!! example "Default log line prefix format"

    ```
    I1103 11:57:31.739339 24395 google.cc:2341] Command line: ./some_prog
    I1103 11:57:31.739403 24395 google.cc:2342] Process id 24395
    ```

!!! note
    Although microseconds are useful for comparing events on a single machine,
    clocks on different machines may not be well synchronized. Hence, use with
    caution when comparing the low bits of timestamps from different machines.

### Format Customization

The predefined log line prefix can be replaced using a user-provided callback
that formats the corresponding output.

For each log entry, the callback will be invoked with a reference to a
`google::LogMessage` instance containing the severity, filename, line
number, thread ID, and time of the event. It will also be given a
reference to the output stream, whose contents will be prepended to the actual
message in the final log line.

To enable the use of a prefix formatter, use the

``` cpp
google::InstallPrefixFormatter(&MyPrefixFormatter);
```

function to pass a pointer to the corresponding `MyPrefixFormatter` callback
during initialization. `InstallPrefixFormatter` takes a second optional argument
of type `#!cpp void*` that allows supplying user data to the callback.

!!! example "Custom prefix formatter"
    The following function outputs a prefix that matches glog's default format.
    The third parameter `data` can be used to access user-supplied data which
    unless specified defaults to `#!cpp nullptr`.

    ``` cpp
    void MyPrefixFormatter(std::ostream& s, const google::LogMessage& m, void* /*data*/) {
       s << google::GetLogSeverityName(m.severity())[0]
       << setw(4) << 1900 + m.time().year()
       << setw(2) << 1 + m.time().month()
       << setw(2) << m.time().day()
       << ' '
       << setw(2) << m.time().hour() << ':'
       << setw(2) << m.time().min()  << ':'
       << setw(2) << m.time().sec() << "."
       << setw(6) << m.time().usec()
       << ' '
       << setfill(' ') << setw(5)
       << m.thread_id() << setfill('0')
       << ' '
       << m.basename() << ':' << m.line() << "]";
    }
    ```


## Conditional / Occasional Logging

Sometimes, you may only want to log a message under certain conditions.
You can use the following macros to perform conditional logging:

``` cpp
LOG_IF(INFO, num_cookies > 10) << "Got lots of cookies";
```

The "Got lots of cookies" message is logged only when the variable
`num_cookies` exceeds 10. If a line of code is executed many times, it may be
useful to only log a message at certain intervals. This kind of logging is most
useful for informational messages.

``` cpp
LOG_EVERY_N(INFO, 10) << "Got the " << google::COUNTER << "th cookie";
```

The above line outputs a log messages on the 1st, 11th, 21st, ... times
it is executed.

!!! note
    The placeholder `#!cpp google::COUNTER` identifies the recurring repetition.

You can combine conditional and occasional logging with the following
macro.

``` cpp
LOG_IF_EVERY_N(INFO, (size > 1024), 10) << "Got the " << google::COUNTER
                                        << "th big cookie";
```

Instead of outputting a message every nth time, you can also limit the
output to the first n occurrences:

``` cpp
LOG_FIRST_N(INFO, 20) << "Got the " << google::COUNTER << "th cookie";
```

Outputs log messages for the first 20 times it is executed. The `#!cpp
google::COUNTER` identifier indicates which repetition is happening.

Other times, it is desired to only log a message periodically based on a
time. For instance, to log a message every 10ms:

``` cpp
LOG_EVERY_T(INFO, 0.01) << "Got a cookie";
```

Or every 2.35s:

``` cpp
LOG_EVERY_T(INFO, 2.35) << "Got a cookie";
```

## Verbose Logging

When you are chasing difficult bugs, thorough log messages are very
useful. However, you may want to ignore too verbose messages in usual
development. For such verbose logging, glog provides the `VLOG` macro, which
allows you to define your own numeric logging levels.

The `#!bash --v` command line option controls which verbose messages are logged:

``` cpp
VLOG(1) << "I’m printed when you run the program with --v=1 or higher";
VLOG(2) << "I’m printed when you run the program with --v=2 or higher";
```

With `VLOG`, the lower the verbose level, the more likely messages are to be
logged. For example, if `#!bash --v==1`, `#!cpp VLOG(1)` will log, but `#!cpp
VLOG(2)` will not log.

!!! warning
    The `VLOG` behavior is opposite of the severity level logging, where
    `INFO`, `ERROR`, etc. are defined in increasing order and thus
    `#!bash --minloglevel` of 1 will only log `WARNING` and above.

Though you can specify any integers for both `VLOG` macro and `--v` flag, the
common values for them are small positive integers. For example, if you write
`#!cpp VLOG(0)`, you should specify `--v=-1` or lower to silence it. This is less
useful since we may not want verbose logs by default in most cases. The `VLOG`
macros always log at the `INFO` log level (when they log at all).

Verbose logging can be controlled from the command line on a per-module basis:

``` bash
--vmodule=mapreduce=2,file=1,gfs*=3 --v=0
```

Specifying these options will specifically:

1.  Print `#!cpp VLOG(2)` and lower messages from mapreduce.{h,cc}
2.  Print `#!cpp VLOG(1)` and lower messages from file.{h,cc}
3.  Print `#!cpp VLOG(3)` and lower messages from files prefixed with "gfs"
4.  Print `#!cpp VLOG(0)` and lower messages from elsewhere

The wildcarding functionality 3. supports both `*` (matches 0 or more
characters) and `?` (matches any single character) wildcards. Please also refer
to [command line flags](flags.md) for more information.

There's also `#!cpp VLOG_IS_ON(n)` "verbose level" condition macro. This macro
returns `#!cpp true` when the `--v` is equal to or greater than `n`. The macro can be
used as follows:

``` cpp
if (VLOG_IS_ON(2)) {
    // (1)
}
```

1. Here we can perform some logging preparation and logging that can’t be
   accomplished with just `#!cpp VLOG(2) << "message ...";`

Verbose level condition macros `VLOG_IF`, `VLOG_EVERY_N` and `VLOG_IF_EVERY_N`
behave analogous to `LOG_IF`, `LOG_EVERY_N`, `LOG_IF_EVERY_N`, but accept a
numeric verbosity level as opposed to a severity level.

``` cpp
VLOG_IF(1, (size > 1024))
   << "I’m printed when size is more than 1024 and when you run the "
      "program with --v=1 or more";
VLOG_EVERY_N(1, 10)
   << "I’m printed every 10th occurrence, and when you run the program "
      "with --v=1 or more. Present occurrence is " << google::COUNTER;
VLOG_IF_EVERY_N(1, (size > 1024), 10)
   << "I’m printed on every 10th occurrence of case when size is more "
      " than 1024, when you run the program with --v=1 or more. ";
      "Present occurrence is " << google::COUNTER;
```


!!! info "Performance"
    The conditional logging macros provided by glog (e.g., `CHECK`, `LOG_IF`,
    `VLOG`, etc.) are carefully implemented and don't execute the right hand
    side expressions when the conditions are false. So, the following check may
    not sacrifice the performance of your application.

    ``` cpp
    CHECK(obj.ok) << obj.CreatePrettyFormattedStringButVerySlow();
    ```

## Debugging Support

Special debug mode logging macros only have an effect in debug mode and are
compiled away to nothing for non-debug mode compiles. Use these macros to avoid
slowing down your production application due to excessive logging.

``` cpp
DLOG(INFO) << "Found cookies";
DLOG_IF(INFO, num_cookies > 10) << "Got lots of cookies";
DLOG_EVERY_N(INFO, 10) << "Got the " << google::COUNTER << "th cookie";
DLOG_FIRST_N(INFO, 10) << "Got the " << google::COUNTER << "th cookie";
DLOG_EVERY_T(INFO, 0.01) << "Got a cookie";
```

## Runtime Checks

It is a good practice to check expected conditions in your program
frequently to detect errors as early as possible. The `CHECK` macro
provides the ability to abort the application when a condition is not met,
similar to the `assert` macro defined in the standard C library.

`CHECK` aborts the application if a condition is not true. Unlike
`assert`, it is **not** controlled by `NDEBUG`, so the check will be executed
regardless of compilation mode. Therefore, `fp->Write(x)` in the following
example is always executed:

``` cpp
CHECK(fp->Write(x) == 4) << "Write failed!";
```

There are various helper macros for equality/inequality checks
-`CHECK_EQ`, `CHECK_NE`, `CHECK_LE`, `CHECK_LT`, `CHECK_GE`, and
`CHECK_GT`. They compare two values, and log a `FATAL` message including the two
values when the result is not as expected. The values must have
`#!cpp operator<<(ostream, ...)` defined.

You may append to the error message like so:

``` cpp
CHECK_NE(1, 2) << ": The world must be ending!";
```

We are very careful to ensure that each argument is evaluated exactly
once, and that anything which is legal to pass as a function argument is legal
here. In particular, the arguments may be temporary expressions which will end
up being destroyed at the end of the apparent statement, for example:

``` cpp
CHECK_EQ(string("abc")[1], ’b’);
```

The compiler reports an error if one of the arguments is a pointer and the other
is `#!cpp nullptr`. To work around this, simply `#!cpp static_cast` `#!cpp
nullptr` to the type of the desired pointer.

``` cpp
CHECK_EQ(some_ptr, static_cast<SomeType*>(nullptr));
```

Better yet, use the `CHECK_NOTNULL` macro:

``` cpp
CHECK_NOTNULL(some_ptr);
some_ptr->DoSomething();
```

Since this macro returns the given pointer, this is very useful in
constructor initializer lists.

``` cpp
struct S {
    S(Something* ptr) : ptr_(CHECK_NOTNULL(ptr)) {}
    Something* ptr_;
};
```

!!! warning
    Due to the argument forwarding, `CHECK_NOTNULL` cannot be used to
    simultaneously stream an additional custom message. To provide a custom
    message, one can use the macro `CHECK_EQ` prior to the failing check.

If you are comparing C strings (`#!cpp char *`), a handy set of macros performs
both case sensitive and insensitive comparisons - `CHECK_STREQ`, `CHECK_STRNE`,
`CHECK_STRCASEEQ`, and `CHECK_STRCASENE`. The `CHECK_*CASE*` macro variants are
case-insensitive. You can safely pass `#!cpp nullptr` pointers to this macro.
They treat `#!cpp nullptr` and any non-`#!cpp nullptr` string as not equal. Two
`#!cpp nullptr`s are equal.

!!! note
    Both arguments may be temporary objects which are destructed at the
    end of the current *full expression*, such as

    ``` cpp
    CHECK_STREQ(Foo().c_str(), Bar().c_str());
    ```

    where `Foo` and `Bar` return `std::string`.

The `CHECK_DOUBLE_EQ` macro checks the equality of two floating point values,
accepting a small error margin. `CHECK_NEAR` accepts a third floating point
argument, which specifies the acceptable error margin.


## Raw Logging

The header file `<glog/raw_logging.h>` can be used for thread-safe logging,
which does not allocate any memory or acquire any locks. Therefore, the macros
defined in this header file can be used by low-level memory allocation and
synchronization code. Please check
[src/glog/raw_logging.h](https://github.com/google/glog/blob/master/src/glog/raw_logging.h)
for detail.

## Google Style `perror()`

`PLOG()` and `PLOG_IF()` and `PCHECK()` behave exactly like their `LOG*` and
`CHECK` equivalents with the addition that they append a description of the
current state of `errno` to their output lines. E.g.

``` cpp
PCHECK(write(1, nullptr, 2) >= 0) << "Write nullptr failed";
```

This check fails with the following error message.

    F0825 185142 test.cc:22] Check failed: write(1, nullptr, 2) >= 0 Write nullptr failed: Bad address [14]

## Syslog

`SYSLOG`, `SYSLOG_IF`, and `SYSLOG_EVERY_N` macros are available. These log to
syslog in addition to the normal logs. Be aware that logging to syslog can
drastically impact performance, especially if syslog is configured for remote
logging! Make sure you understand the implications of outputting to syslog
before you use these macros. In general, it's wise to use these macros
sparingly.


================================================
FILE: docs/overrides/main.html
================================================
{% extends "base.html" %}

{% block outdated %}
  You're not viewing the latest version.
  <a href="{{ '../' ~ base_url }}">
    <strong>Click here to go to latest.</strong>
  </a>
{% endblock %}


================================================
FILE: docs/packages.md
================================================
# Installation using Package Managers

## conan

You can download and install glog using the [conan](https://conan.io)
package manager:

``` bash
pip install conan
conan install -r conancenter glog/<glog-version>@
```

The glog recipe in conan center is kept up to date by conan center index
community contributors. If the version is out of date, please create an
issue or pull request on the
[conan-center-index](https://github.com/conan-io/conan-center-index)
repository.

## vcpkg

You can download and install glog using the
[vcpkg](https://github.com/Microsoft/vcpkg) dependency manager:

``` bash
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
./vcpkg install glog
```

The glog port in vcpkg is kept up to date by Microsoft team members and
community contributors. If the version is out of date, please create an
issue or pull request on the vcpkg repository.


================================================
FILE: docs/requirements.txt
================================================
mike>=2.1.1
mkdocs-git-committers-plugin-2>=2.3.0
mkdocs-git-revision-date-localized-plugin>=1.2.6
mkdocs-material-extensions>=1.3.1
mkdocs-material>=9.5.26
mkdocs>=1.6.0


================================================
FILE: docs/sinks.md
================================================
# Custom Sinks

Under certain circumstances, it is useful to send the log output to a
destination other than a file, `stderr` and/or `stdout`. In case, the library
provides the `#!cpp google::LogSink` interface whose implementations can be used
to write the log output to arbitrary locations.

## Basic Interface

The sink interface is defined as follows:

``` cpp
class LogSink {
 public:
  virtual void send(LogSeverity severity, const char* full_filename,
                    const char* base_filename, int line,
                    const LogMessageTime& time, const char* message,
                    size_t message_len);
};
```

The user must implement `#!cpp google::LogSink::send`, which is called by the
library every time a message is logged.

!!! warning "Possible deadlock due to nested logging"
    This method can't use `LOG()` or `CHECK()` as logging system mutex(s) are
    held during this call.

## Registering Log Sinks

To use the custom sink and instance of the above interface implementation must
be registered using `google::AddLogSink` which expects a pointer to the
`google::LogSink` instance. To unregister use `google::RemoveLogSink`. Both
functions are thread-safe.

!!! danger "`LogSink` ownership"
    The `google::LogSink` instance must not be destroyed until the referencing
    pointer is unregistered.

## Direct Logging

Instead of registering the sink, we can directly use to log messages. While `#!
LOG_TO_SINK(sink, severity)` allows to log both to the sink and to a global log
registry, e.g., a file, `#!cpp LOG_TO_SINK_BUT_NOT_TO_LOGFILE(sink, severity)`
will avoid the latter.

!!! example "Using a custom sink"
    ``` cpp title="custom_sink.cc"
    -8<- "examples/custom_sink.cc:33:"
    ```

    1. `MySink` implements a custom sink that sends log messages to `std::cout`.
    2. The custom sink must be registered to for use with existing logging
       macros.
    3. Once the custom sink is no longer needed we remove it from the registry.
    4. A sink does not need to be registered globally. However, then, messages
       must be logged using dedicated macros.

    Running the above example as `#!bash GLOG_log_dir=. ./custom_sink_example`
    will produce

    <div class="annotate" markdown>

    ``` title="Custom sink output"
    INFO custom_sink.cc:63 logging to MySink
    INFO custom_sink.cc:68 direct logging
    INFO custom_sink.cc:69 direct logging but not to file (1)
    ```

    </div>

    1. This line is not present in the log file because we used
       `LOG_TO_SINK_BUT_NOT_TO_LOGFILE` to log the message.

    and the corresponding log file will contain

    ``` title="Log file generated with the custom sink"
    Log file created at: 2024/06/11 13:24:27
    Running on machine: pc
    Running duration (h:mm:ss): 0:00:00
    Log line format: [IWEF]yyyymmdd hh:mm:ss.uuuuuu threadid file:line] msg
    I20240611 13:24:27.476620 126237946035776 custom_sink.cc:63] logging to MySink
    I20240611 13:24:27.476796 126237946035776 custom_sink.cc:68] direct logging
    ```


================================================
FILE: docs/unwinder.md
================================================
# Installation Notes for 64-bit Linux Systems

!!! note
    The description on this page is possibly not up-to-date.

The [glibc built-in stack-unwinder](#glibc-built-in-stack-unwinder) on 64-bit
systems has some problems with glog. In particular, if you are using
[`InstallFailureSignalHandler()`](failures.md), the signal may be raised in the
middle of `malloc`, holding some `malloc`-related locks when they invoke the
stack unwinder. The built-in stack unwinder may call `malloc` recursively, which
may require the thread to acquire a lock it already holds resulting in a
deadlock.

## Recommended Approach: `libunwind`

For above reason, if you use a 64-bit system and you need
`InstallFailureSignalHandler()`, we strongly recommend you install `libunwind`
before trying to configure or install google glog. libunwind can be found
[here](http://download.savannah.nongnu.org/releases/libunwind/libunwind-snap-070410.tar.gz).

Even if you already have `libunwind` installed, you will probably still need to
install from the snapshot to get the latest version.

!!! warning
    If you install libunwind from the URL above, be aware that you may have
    trouble if you try to statically link your binary with glog: that is, if you
    link with `gcc -static -lgcc_eh ...`. This is because both `libunwind` and
    `libgcc` implement the same C++ exception handling APIs, but they implement
    them differently on some platforms. This is not likely to be a problem on
    ia64, but may be on x86-64.

Also, if you link binaries statically, make sure that you add
`-Wl,--eh-frame-hdr` to your linker options. This is required so that
`libunwind` can find the information generated by the compiler required for
stack unwinding.

Using `-static` is rare, though, so unless you know this will affect you it
probably won't.

## Alternative Stack-unwinder

If you cannot or do not wish to install `libunwind`, you can still try to use
two kinds of stack-unwinder:

### glibc Built-in Stack-unwinder

As we already mentioned, glibc's unwinder has a deadlock issue. However, if you
don't use `InstallFailureSignalHandler()` or you don't worry about the rare
possibilities of deadlocks, you can use this stack-unwinder. If you specify no
options and `libunwind` isn't detected on your system, the configure script
chooses this unwinder by default.

### Frame Pointer based Stack-unwinder

The frame pointer based stack unwinder requires that your application, the glog
library, and system libraries like libc, all be compiled with a frame pointer.
This is *not* the default for x86-64.


================================================
FILE: docs/usage.md
================================================
# Using glog in a CMake Project

Assuming that glog was previously [built using CMake](build.md#cmake) or
installed using a package manager, you can use the CMake command `#!cmake
find_package` to build against glog in your CMake project as follows:

``` cmake title="CMakeLists.txt"
cmake_minimum_required (VERSION 3.16)
project (myproj VERSION 1.0)

find_package (glog 0.8.0 REQUIRED)

add_executable (myapp main.cpp)
target_link_libraries (myapp glog::glog)
```

Compile definitions and options will be added automatically to your target as
needed.

Alternatively, glog can be incorporated into using the CMake command `#!cmake
add_subdirectory` to include glog directly from a subdirectory of your project
by replacing the `#!cmake find_package` call from the previous snippet by
`add_subdirectory`. The `#!cmake glog::glog` target is in this case an `#!cmake
ALIAS` library target for the `glog` library target.


================================================
FILE: docs/windows.md
================================================
# Notes for Windows Users

glog defines the severity level `ERROR`, which is also defined by `windows.h`.
You can make glog not define `INFO`, `WARNING`, `ERROR`, and `FATAL` by defining
`GLOG_NO_ABBREVIATED_SEVERITIES` before including `glog/logging.h`. Even with
this macro, you can still use the iostream like logging facilities:

``` cpp
#define GLOG_NO_ABBREVIATED_SEVERITIES
#include <windows.h>
#include <glog/logging.h>

// ...

LOG(ERROR) << "This should work";
LOG_IF(ERROR, x > y) << "This should be also OK";
```

However, you cannot use `INFO`, `WARNING`, `ERROR`, and `FATAL` anymore for
functions defined in `glog/logging.h`.

``` cpp
#define GLOG_NO_ABBREVIATED_SEVERITIES
#include <windows.h>
#include <glog/logging.h>

// ...

// This won’t work.
// google::FlushLogFiles(google::ERROR);

// Use this instead.
google::FlushLogFiles(google::GLOG_ERROR);
```

If you don't need `ERROR` defined by `windows.h`, there are a couple of more
workarounds which sometimes don't work[^1]:

-  `#!cpp #define WIN32_LEAN_AND_MEAN` or `NOGDI` **before**
   `#!cpp #include <windows.h>`.
-  `#!cpp #undef ERROR` **after** `#!cpp #include <windows.h>`.

[^1]: For more information refer to [this
      issue](http://code.google.com/p/google-glog/issues/detail?id=33).


================================================
FILE: examples/custom_sink.cc
================================================
// Copyright (c) 2024, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//     * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//     * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: Sergiu Deitsch
//

#include <glog/logging.h>

#include <algorithm>
#include <cstddef>
#include <iostream>
#include <iterator>

namespace {

struct MyLogSink : google::LogSink {  // (1)!
  void send(google::LogSeverity severity, const char* /*full_filename*/,
            const char* base_filename, int line,
            const google::LogMessageTime& /*time*/, const char* message,
            std::size_t message_len) override {
    std::cout << google::GetLogSeverityName(severity) << ' ' << base_filename
              << ':' << line << ' ';
    std::copy_n(message, message_len,
                std::ostreambuf_iterator<char>{std::cout});
    std::cout << '\n';
  }
};

}  // namespace

int main(int /*argc*/, char** argv) {
  google::InitGoogleLogging(argv[0]);

  MyLogSink sink;
  google::AddLogSink(&sink);  // (2)!

  LOG(INFO) << "logging to MySink";

  google::RemoveLogSink(&sink);  // (3)!

  // We can directly log to a sink without registering it
  LOG_TO_SINK(&sink, INFO) << "direct logging";  // (4)!
  LOG_TO_SINK_BUT_NOT_TO_LOGFILE(&sink, INFO)
      << "direct logging but not to file";
}


================================================
FILE: gcovr.cfg
================================================
exclude = src/.*_unittest\.cc
exclude = src/googletest\.h
exclude = src/mock-log\.h
exclude-directories = Tests/
exclude-throw-branches = yes
exclude-unreachable-branches = yes
filter = .*/glog/.*\.h
filter = src/


================================================
FILE: glog-config.cmake.in
================================================
if (CMAKE_VERSION VERSION_LESS @glog_CMake_VERSION@)
  message (FATAL_ERROR "CMake >= @glog_CMake_VERSION@ required")
endif (CMAKE_VERSION VERSION_LESS @glog_CMake_VERSION@)

@PACKAGE_INIT@

include (CMakeFindDependencyMacro)
include (${CMAKE_CURRENT_LIST_DIR}/glog-modules.cmake)

find_dependency (Threads)

@gflags_DEPENDENCY@
@Unwind_DEPENDENCY@

include (${CMAKE_CURRENT_LIST_DIR}/glog-targets.cmake)


================================================
FILE: glog-modules.cmake.in
================================================
cmake_policy (PUSH)
cmake_policy (SET CMP0057 NEW)

if (CMAKE_VERSION VERSION_LESS 3.3)
  message (FATAL_ERROR "glog-modules.cmake requires the consumer "
    "to use CMake 3.3 (or newer)")
endif (CMAKE_VERSION VERSION_LESS 3.3)

set (glog_MODULE_PATH "@glog_FULL_CMake_DATADIR@")
list (APPEND CMAKE_MODULE_PATH ${glog_MODULE_PATH})

if (NOT glog_MODULE_PATH IN_LIST CMAKE_MODULE_PATH)
  message (FATAL_ERROR "Cannot add '${glog_MODULE_PATH}' to "
    "CMAKE_MODULE_PATH. This will cause glog-config.cmake to fail at "
    "locating required find modules. Make sure CMAKE_MODULE_PATH is not a cache variable.")
endif (NOT glog_MODULE_PATH IN_LIST CMAKE_MODULE_PATH)

cmake_policy (POP)


================================================
FILE: libglog.pc.in
================================================
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@

Name: libglog
Description: Google Log (glog) C++ logging framework
Version: @VERSION@
Libs: -L${libdir} -lglog
Libs.private: @glog_libraries_options_for_static_linking@
Cflags: -I${includedir}


================================================
FILE: mkdocs.yml
================================================
---
site_name: Google Logging Library
site_url: https://google.github.io/glog/
repo_url: https://github.com/google/glog
repo_name: google/glog
edit_uri: edit/master/docs/
copyright: Copyright &copy; 2024 Google Inc. &amp; contributors - <a href="#__consent">Change cookie settings</a>
markdown_extensions:
  - admonition
  - attr_list
  - def_list
  - footnotes
  - md_in_html
  - pymdownx.details
  - pymdownx.highlight:
      anchor_linenums: true
      line_spans: __span
      pygments_lang_class: true
  - pymdownx.inlinehilite
  - pymdownx.snippets:
      base_path:
        - '.'
      check_paths: true
  - pymdownx.superfences
  - tables
  - toc:
      permalink: true
theme:
  name: material
  custom_dir: docs/overrides
  icon:
    annotation: material/chevron-right-circle
    edit: material/pencil
    repo: fontawesome/brands/git-alt
    view: material/eye
  language: en
  features:
    - content.action.edit
    - content.code.annotate
    - content.code.copy
    - content.code.select
    - header.autohide
    - navigation.expand
    - navigation.instant.preview
    - navigation.instant.progress
    - navigation.prune
    - navigation.indexes
    - toc.follow
    - navigation.top
    - navigation.path
    # - navigation.sections
    # - navigation.tabs
    # - navigation.tabs.sticky
    - navigation.tracking
    - search.highlight
    - search.share
    - search.suggest
  palette:
    # Palette toggle for automatic mode
    - media: "(prefers-color-scheme)"
      toggle:
        icon: material/brightness-auto
        name: Switch to light mode
    # Palette toggle for light mode
    - media: "(prefers-color-scheme: light)"
      scheme: default
      primary: teal
      accent: green
      toggle:
        icon: material/brightness-7
        name: Switch to dark mode
    # Palette toggle for dark mode
    - media: "(prefers-color-scheme: dark)"
      scheme: slate
      primary: black
      toggle:
        icon: material/brightness-4
        name: Switch to system preference
plugins:
  - git-revision-date-localized:
      enable_creation_date: true
  - git-committers:
      repository: google/glog
      branch: master
  - privacy
  - search
  - tags
extra:
  version:
    alias: true
    default:
      - dev
      - stable
    provider: mike
  consent:
    actions:
      - manage
      - accept
      - reject
    title: Cookie consent
    description: >-
      We use cookies to recognize your repeated visits and preferences, as well
      as to measure the effectiveness of our documentation and whether users
      find what they're searching for. With your consent, you're helping us to
      make our documentation better.
nav:
  - Getting Started:
      - Overview: index.md
      - Usage in CMake Projects: usage.md
      - Building from Source: build.md
      - Installation using Package Managers: packages.md
  - User Guide:
      - Logging: logging.md
      - Adjusting Output: flags.md
      - Custom Sinks: sinks.md
      - Failure Handler: failures.md
      - Log Removal: log_cleaner.md
      - Stripping Log Messages: log_stripping.md
      - System-specific Considerations:
          - Usage on Windows: windows.md
          - Linux Unwinder: unwinder.md
  - Contributing: contribute.md
  - License: license.md


================================================
FILE: src/base/commandlineflags.h
================================================
// Copyright (c) 2008, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//     * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//     * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

// ---
// This file is a compatibility layer that defines Google's version of
// command line flags that are used for configuration.
//
// We put flags into their own namespace.  It is purposefully
// named in an opaque way that people should have trouble typing
// directly.  The idea is that DEFINE puts the flag in the weird
// namespace, and DECLARE imports the flag from there into the
// current namespace.  The net result is to force people to use
// DECLARE to get access to a flag, rather than saying
//   extern bool FLAGS_logtostderr;
// or some such instead.  We want this so we can put extra
// functionality (like sanity-checking) in DECLARE if we want,
// and make sure it is picked up everywhere.
//
// We also put the type of the variable in the namespace, so that
// people can't DECLARE_int32 something that they DEFINE_bool'd
// elsewhere.
#ifndef BASE_COMMANDLINEFLAGS_H__
#define BASE_COMMANDLINEFLAGS_H__

#include <cstdlib>  // for getenv
#include <cstring>  // for memchr
#include <string>

#include "config.h"

#ifdef GLOG_USE_GFLAGS

#  include <gflags/gflags.h>

#else

#  include "glog/logging.h"

#  define DECLARE_VARIABLE(type, shorttype, name, tn) \
    namespace fL##shorttype {                         \
      extern GLOG_EXPORT type FLAGS_##name;           \
    }                                                 \
    using fL##shorttype::FLAGS_##name
#  define DEFINE_VARIABLE(type, shorttype, name, value, meaning, tn) \
    namespace fL##shorttype {                                        \
      GLOG_EXPORT type FLAGS_##name(value);                          \
      char FLAGS_no##name;                                           \
    }                                                                \
    using fL##shorttype::FLAGS_##name

// bool specialization
#  define DECLARE_bool(name) DECLARE_VARIABLE(bool, B, name, bool)
#  define DEFINE_bool(name, value, meaning) \
    DEFINE_VARIABLE(bool, B, name, value, meaning, bool)

// int32 specialization
#  define DECLARE_int32(name) DECLARE_VARIABLE(google::int32, I, name, int32)
#  define DEFINE_int32(name, value, meaning) \
    DEFINE_VARIABLE(google::int32, I, name, value, meaning, int32)

// uint32 specialization
#  ifndef DECLARE_uint32
#    define DECLARE_uint32(name) \
      DECLARE_VARIABLE(google::uint32, U, name, uint32)
#  endif  // DECLARE_uint64
#  define DEFINE_uint32(name, value, meaning) \
    DEFINE_VARIABLE(google::uint32, U, name, value, meaning, uint32)

// Special case for string, because we have to specify the namespace
// std::string, which doesn't play nicely with our FLAG__namespace hackery.
#  define DECLARE_string(name)                    \
    namespace fLS {                               \
    extern GLOG_EXPORT std::string& FLAGS_##name; \
    }                                             \
    using fLS::FLAGS_##name
#  define DEFINE_string(name, value, meaning)                   \
    namespace fLS {                                             \
    std::string FLAGS_##name##_buf(value);                      \
    GLOG_EXPORT std::string& FLAGS_##name = FLAGS_##name##_buf; \
    char FLAGS_no##name;                                        \
    }                                                           \
    using fLS::FLAGS_##name

#endif  // GLOG_USE_GFLAGS

// Define GLOG_DEFINE_* using DEFINE_* . By using these macros, we
// have GLOG_* environ variables even if we have gflags installed.
//
// If both an environment variable and a flag are specified, the value
// specified by a flag wins. E.g., if GLOG_v=0 and --v=1, the
// verbosity will be 1, not 0.

#define GLOG_DEFINE_bool(name, value, meaning) \
  DEFINE_bool(name, EnvToBool("GLOG_" #name, value), meaning)

#define GLOG_DEFINE_int32(name, value, meaning) \
  DEFINE_int32(name, EnvToInt("GLOG_" #name, value), meaning)

#define GLOG_DEFINE_uint32(name, value, meaning) \
  DEFINE_uint32(name, EnvToUInt("GLOG_" #name, value), meaning)

#define GLOG_DEFINE_string(name, value, meaning) \
  DEFINE_string(name, EnvToString("GLOG_" #name, value), meaning)

// These macros (could be functions, but I don't want to bother with a .cc
// file), make it easier to initialize flags from the environment.

#define EnvToString(envname, dflt) (!getenv(envname) ? (dflt) : getenv(envname))

#define EnvToBool(envname, dflt) \
  (!getenv(envname) ? (dflt)     \
                    : memchr("tTyY1\0", getenv(envname)[0], 6) != nullptr)

#define EnvToInt(envname, dflt) \
  (!getenv(envname) ? (dflt)    \
                    : static_cast<int>(strtol(getenv(envname), nullptr, 10)))

#define EnvToUInt(envname, dflt) \
  (!getenv(envname)              \
       ? (dflt)                  \
       : static_cast<unsigned>(strtoul(getenv(envname), nullptr, 10)))

#endif  // BASE_COMMANDLINEFLAGS_H__


================================================
FILE: src/base/googleinit.h
================================================
// Copyright (c) 2008, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//     * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//     * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

// ---
// Author: Jacob Hoffman-Andrews

#ifndef _GOOGLEINIT_H
#define _GOOGLEINIT_H

class GoogleInitializer {
 public:
  using void_function = void (*)();
  GoogleInitializer(const char*, void_function f) { f(); }
};

#define REGISTER_MODULE_INITIALIZER(name, body)       \
  namespace {                                         \
  static void google_init_module_##name() { body; }   \
  GoogleInitializer google_initializer_module_##name( \
      #name, google_init_module_##name);              \
  }

#endif /* _GOOGLEINIT_H */


================================================
FILE: src/cleanup_immediately_unittest.cc
================================================
// Copyright (c) 2024, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//     * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//     * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include "base/commandlineflags.h"
#include "glog/logging.h"
#include "glog/raw_logging.h"
#include "googletest.h"

#ifdef GLOG_USE_GFLAGS
#  include <gflags/gflags.h>
using namespace GFLAGS_NAMESPACE;
#endif

#ifdef HAVE_LIB_GMOCK
#  include <gmock/gmock.h>

#  include "mock-log.h"
// Introduce several symbols from gmock.
using google::glog_testing::ScopedMockLog;
using testing::_;
using testing::AllOf;
using testing::AnyNumber;
using testing::HasSubstr;
using testing::InitGoogleMock;
using testing::StrictMock;
using testing::StrNe;
#endif

using namespace google;

TEST(CleanImmediately, logging) {
  using namespace std::chrono_literals;
  google::SetLogFilenameExtension(".foobar");
  google::EnableLogCleaner(0h);

  for (unsigned i = 0; i < 1000; ++i) {
    LOG(INFO) << "cleanup test";
  }

  google::DisableLogCleaner();
}

int main(int argc, char** argv) {
  FLAGS_colorlogtostderr = false;
  FLAGS_timestamp_in_logfile_name = true;
#ifdef GLOG_USE_GFLAGS
  ParseCommandLineFlags(&argc, &argv, true);
#endif
  // Make sure stderr is not buffered as stderr seems to be buffered
  // on recent windows.
  setbuf(stderr, nullptr);

  // Test some basics before InitGoogleLogging:
  CaptureTestStderr();
  const string early_stderr = GetCapturedTestStderr();

  EXPECT_FALSE(IsGoogleLoggingInitialized());

  InitGoogleLogging(argv[0]);

  EXPECT_TRUE(IsGoogleLoggingInitialized());

  InitGoogleTest(&argc, argv);
#ifdef HAVE_LIB_GMOCK
  InitGoogleMock(&argc, argv);
#endif

  // so that death tests run before we use threads
  CHECK_EQ(RUN_ALL_TESTS(), 0);
}


================================================
FILE: src/cleanup_with_absolute_prefix_unittest.cc
================================================
// Copyright (c) 2024, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//     * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//     * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include "base/commandlineflags.h"
#include "glog/logging.h"
#include "glog/raw_logging.h"
#include "googletest.h"

#ifdef GLOG_USE_GFLAGS
#  include <gflags/gflags.h>
using namespace GFLAGS_NAMESPACE;
#endif

#ifdef HAVE_LIB_GMOCK
#  include <gmock/gmock.h>

#  include "mock-log.h"
// Introduce several symbols from gmock.
using google::glog_testing::ScopedMockLog;
using testing::_;
using testing::AllOf;
using testing::AnyNumber;
using testing::HasSubstr;
using testing::InitGoogleMock;
using testing::StrictMock;
using testing::StrNe;
#endif

using namespace google;

TEST(CleanImmediatelyWithAbsolutePrefix, logging) {
  using namespace std::chrono_literals;
  google::EnableLogCleaner(0h);
  google::SetLogFilenameExtension(".barfoo");
  google::SetLogDestination(GLOG_INFO, "test_cleanup_");

  for (unsigned i = 0; i < 1000; ++i) {
    LOG(INFO) << "cleanup test";
  }

  for (unsigned i = 0; i < 10; ++i) {
    LOG(ERROR) << "cleanup test";
  }

  google::DisableLogCleaner();
}

int main(int argc, char** argv) {
  FLAGS_colorlogtostderr = false;
  FLAGS_timestamp_in_logfile_name = true;
#ifdef GLOG_USE_GFLAGS
  ParseCommandLineFlags(&argc, &argv, true);
#endif
  // Make sure stderr is not buffered as stderr seems to be buffered
  // on recent windows.
  setbuf(stderr, nullptr);

  // Test some basics before InitGoogleLogging:
  CaptureTestStderr();
  const string early_stderr = GetCapturedTestStderr();

  EXPECT_FALSE(IsGoogleLoggingInitialized());

  InitGoogleLogging(argv[0]);

  EXPECT_TRUE(IsGoogleLoggingInitialized());

  InitGoogleTest(&argc, argv);
#ifdef HAVE_LIB_GMOCK
  InitGoogleMock(&argc, argv);
#endif

  // so that death tests run before we use threads
  CHECK_EQ(RUN_ALL_TESTS(), 0);
}


================================================
FILE: src/cleanup_with_relative_prefix_unittest.cc
================================================
// Copyright (c) 2024, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//     * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//     * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include "base/commandlineflags.h"
#include "glog/logging.h"
#include "glog/raw_logging.h"
#include "googletest.h"

#ifdef GLOG_USE_GFLAGS
#  include <gflags/gflags.h>
using namespace GFLAGS_NAMESPACE;
#endif

#ifdef HAVE_LIB_GMOCK
#  include <gmock/gmock.h>

#  include "mock-log.h"
// Introduce several symbols from gmock.
using google::glog_testing::ScopedMockLog;
using testing::_;
using testing::AllOf;
using testing::AnyNumber;
using testing::HasSubstr;
using testing::InitGoogleMock;
using testing::StrictMock;
using testing::StrNe;
#endif

using namespace google;

TEST(CleanImmediatelyWithRelativePrefix, logging) {
  using namespace std::chrono_literals;
  google::EnableLogCleaner(0h);
  google::SetLogFilenameExtension(".relativefoo");
  google::SetLogDestination(GLOG_INFO, "test_subdir/test_cleanup_");

  for (unsigned i = 0; i < 1000; ++i) {
    LOG(INFO) << "cleanup test";
  }

  google::DisableLogCleaner();
}

int main(int argc, char** argv) {
  FLAGS_colorlogtostderr = false;
  FLAGS_timestamp_in_logfile_name = true;
#ifdef GLOG_USE_GFLAGS
  ParseCommandLineFlags(&argc, &argv, true);
#endif
  // Make sure stderr is not buffered as stderr seems to be buffered
  // on recent windows.
  setbuf(stderr, nullptr);

  // Test some basics before InitGoogleLogging:
  CaptureTestStderr();
  const string early_stderr = GetCapturedTestStderr();

  EXPECT_FALSE(IsGoogleLoggingInitialized());

  InitGoogleLogging(argv[0]);

  EXPECT_TRUE(IsGoogleLoggingInitialized());

  InitGoogleTest(&argc, argv);
#ifdef HAVE_LIB_GMOCK
  InitGoogleMock(&argc, argv);
#endif

  // so that death tests run before we use threads
  CHECK_EQ(RUN_ALL_TESTS(), 0);
}


================================================
FILE: src/config.h.cmake.in
================================================
#ifndef GLOG_CONFIG_H
#define GLOG_CONFIG_H

/* Define if you have the `dladdr' function */
#cmakedefine HAVE_DLADDR

/* Define to 1 if you have the <dlfcn.h> header file. */
#cmakedefine HAVE_DLFCN_H

/* Define if you have the `backtrace' function in <execinfo.h> */
#cmakedefine HAVE_EXECINFO_BACKTRACE

/* Define if you have the `backtrace_symbols' function in <execinfo.h> */
#cmakedefine HAVE_EXECINFO_BACKTRACE_SYMBOLS

/* Define if you have the `fcntl' function */
#cmakedefine HAVE_FCNTL

/* Define to 1 if you have the <glob.h> header file. */
#cmakedefine HAVE_GLOB_H

/* define if you have google gmock library */
#cmakedefine HAVE_LIB_GMOCK

/* define if you have google gtest library */
#cmakedefine HAVE_LIB_GTEST

/* define if you have dbghelp library */
#cmakedefine HAVE_DBGHELP

/* Define if you have the 'pread' function */
#cmakedefine HAVE_PREAD

/* Define if you have the 'posix_fadvise' function in <fcntl.h> */
#cmakedefine HAVE_POSIX_FADVISE

/* Define to 1 if you have the <pwd.h> header file. */
#cmakedefine HAVE_PWD_H

/* Define if you have the 'pwrite' function */
#cmakedefine HAVE_PWRITE

/* Define if you have the 'sigaction' function */
#cmakedefine HAVE_SIGACTION

/* Define if you have the `sigaltstack' function */
#cmakedefine HAVE_SIGALTSTACK

/* Define to 1 if you have the <syscall.h> header file. */
#cmakedefine HAVE_SYSCALL_H

/* Define to 1 if you have the <syslog.h> header file. */
#cmakedefine HAVE_SYSLOG_H

/* Define to 1 if you have the <elf.h> header file. */
#cmakedefine HAVE_ELF_H

/* Define to 1 if you have the <sys/exec_elf.h> header file. */
#cmakedefine HAVE_SYS_EXEC_ELF_H

/* Define to 1 if you have the <link.h> header file. */
#cmakedefine HAVE_LINK_H

/* Define to 1 if you have the <sys/syscall.h> header file. */
#cmakedefine HAVE_SYS_SYSCALL_H

/* Define to 1 if you have the <sys/time.h> header file. */
#cmakedefine HAVE_SYS_TIME_H

/* Define to 1 if you have the <sys/types.h> header file. */
#cmakedefine HAVE_SYS_TYPES_H

/* Define to 1 if you have the <sys/ucontext.h> header file. */
#cmakedefine HAVE_SYS_UCONTEXT_H

/* Define to 1 if you have the <sys/utsname.h> header file. */
#cmakedefine HAVE_SYS_UTSNAME_H

/* Define to 1 if you have the <sys/wait.h> header file. */
#cmakedefine HAVE_SYS_WAIT_H

/* Define to 1 if you have the <ucontext.h> header file. */
#cmakedefine HAVE_UCONTEXT_H

/* Define to 1 if you have the <unistd.h> header file. */
#cmakedefine HAVE_UNISTD_H ${HAVE_UNISTD_H}

/* define if you have unwind */
#cmakedefine HAVE_UNWIND

/* define if you have libunwind */
#cmakedefine HAVE_LIBUNWIND

/* define if symbolize support is available */
#cmakedefine HAVE_SYMBOLIZE

/* define if localtime_r is available in time.h */
#cmakedefine HAVE_LOCALTIME_R

/* define if gmtime_r is available in time.h */
#cmakedefine HAVE_GMTIME_R

/* define if _chsize_s is available in io.h */
#cmakedefine HAVE__CHSIZE_S

/* define if ssize_t is defined */
#cmakedefine HAVE_SSIZE_T

/* define if mode_t is defined */
#cmakedefine HAVE_MODE_T

/* How to access the PC from a struct ucontext */
#cmakedefine PC_FROM_UCONTEXT ${PC_FROM_UCONTEXT}

/* define if we should print file offsets in traces instead of symbolizing. */
#cmakedefine PRINT_UNSYMBOLIZED_STACK_TRACES

/* The size of `void *', as computed by sizeof. */
#cmakedefine SIZEOF_VOID_P ${SIZEOF_VOID_P}

/* location of source code */
#cmakedefine TEST_SRC_DIR ${TEST_SRC_DIR}

/* Define if thread-local storage is enabled. */
#cmakedefine GLOG_THREAD_LOCAL_STORAGE

/* define if abi::__cxa_demangle is available in cxxabi.h */
#cmakedefine HAVE___CXA_DEMANGLE

/* define if __argv is available in cstdlib */
#cmakedefine HAVE___ARGV

/* define if __progname is available */
#cmakedefine HAVE___PROGNAME

/* define if getprogname is available in cstdlib */
#cmakedefine HAVE_GETPROGNAME

/* define if program_invocation_short_name is available in cerrno */
#cmakedefine HAVE_PROGRAM_INVOCATION_SHORT_NAME

#endif  // GLOG_CONFIG_H


================================================
FILE: src/dcheck_unittest/CMakeLists.txt
================================================
cmake_minimum_required (VERSION 3.16)
project (glog_log_severity LANGUAGES CXX)

find_package (glog REQUIRED NO_MODULE)

add_executable (glog_dcheck glog_dcheck.cc)
target_link_libraries (glog_dcheck PRIVATE glog::glog)


================================================
FILE: src/dcheck_unittest/glog_dcheck.cc
================================================
// Copyright (c) 2024, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//     * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//     * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: Sergiu Deitsch

#include <glog/logging.h>

int main(int /*argc*/, char** argv) {
  google::InitGoogleLogging(argv[0]);
  google::InstallFailureSignalHandler();

#if defined(_MSC_VER)
  // Avoid presenting an interactive dialog that will cause the test to time
  // out.
  _set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
#endif  // defined(_MSC_VER)

  DLOG(INFO) << "no output";
  DLOG(WARNING) << "no output";
  DLOG(ERROR) << "no output";

  // Must not fail in release build
  DLOG_ASSERT(false);

  // Must be the last expression
  DLOG(FATAL) << "no output";
}


================================================
FILE: src/demangle.cc
================================================
// Copyright (c) 2024, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//     * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//     * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: Satoru Takabayashi
//
// For reference check out:
// http://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling
//
// Note that we only have partial C++0x support yet.

#include "demangle.h"

#include <algorithm>
#include <cstdlib>
#include <limits>

#include "utilities.h"

#if defined(HAVE___CXA_DEMANGLE)
#  include <cxxabi.h>
#endif

#if defined(GLOG_OS_WINDOWS)
#  include <dbghelp.h>
#endif

namespace google {
inline namespace glog_internal_namespace_ {

#if !defined(GLOG_OS_WINDOWS) && !defined(HAVE___CXA_DEMANGLE)
namespace {
struct AbbrevPair {
  const char* const abbrev;
  const char* const real_name;
};

// List of operators from Itanium C++ ABI.
const AbbrevPair kOperatorList[] = {
    {"nw", "new"},    {"na", "new[]"},    {"dl", "delete"}, {"da", "delete[]"},
    {"ps", "+"},      {"ng", "-"},        {"ad", "&"},      {"de", "*"},
    {"co", "~"},      {"pl", "+"},        {"mi", "-"},      {"ml", "*"},
    {"dv", "/"},      {"rm", "%"},        {"an", "&"},      {"or", "|"},
    {"eo", "^"},      {"aS", "="},        {"pL", "+="},     {"mI", "-="},
    {"mL", "*="},     {"dV", "/="},       {"rM", "%="},     {"aN", "&="},
    {"oR", "|="},     {"eO", "^="},       {"ls", "<<"},     {"rs", ">>"},
    {"lS", "<<="},    {"rS", ">>="},      {"eq", "=="},     {"ne", "!="},
    {"lt", "<"},      {"gt", ">"},        {"le", "<="},     {"ge", ">="},
    {"nt", "!"},      {"aa", "&&"},       {"oo", "||"},     {"pp", "++"},
    {"mm", "--"},     {"cm", ","},        {"pm", "->*"},    {"pt", "->"},
    {"cl", "()"},     {"ix", "[]"},       {"qu", "?"},      {"st", "sizeof"},
    {"sz", "sizeof"}, {nullptr, nullptr},
};

// List of builtin types from Itanium C++ ABI.
const AbbrevPair kBuiltinTypeList[] = {
    {"v", "void"},        {"w", "wchar_t"},
    {"b", "bool"},        {"c", "char"},
    {"a", "signed char"}, {"h", "unsigned char"},
    {"s", "short"},       {"t", "unsigned short"},
    {"i", "int"},         {"j", "unsigned int"},
    {"l", "long"},        {"m", "unsigned long"},
    {"x", "long long"},   {"y", "unsigned long long"},
    {"n", "__int128"},    {"o", "unsigned __int128"},
    {"f", "float"},       {"d", "double"},
    {"e", "long double"}, {"g", "__float128"},
    {"z", "ellipsis"},    {"Dn", "decltype(nullptr)"},
    {nullptr, nullptr}};

// List of substitutions Itanium C++ ABI.
const AbbrevPair kSubstitutionList[] = {
    {"St", ""},
    {"Sa", "allocator"},
    {"Sb", "basic_string"},
    // std::basic_string<char, std::char_traits<char>,std::allocator<char> >
    {"Ss", "string"},
    // std::basic_istream<char, std::char_traits<char> >
    {"Si", "istream"},
    // std::basic_ostream<char, std::char_traits<char> >
    {"So", "ostream"},
    // std::basic_iostream<char, std::char_traits<char> >
    {"Sd", "iostream"},
    {nullptr, nullptr}};

// State needed for demangling.
struct State {
  const char* mangled_cur;   // Cursor of mangled name.
  char* out_cur;             // Cursor of output string.
  const char* out_begin;     // Beginning of output string.
  const char* out_end;       // End of output string.
  const char* prev_name;     // For constructors/destructors.
  ssize_t prev_name_length;  // For constructors/destructors.
  short nest_level;          // For nested names.
  bool append;               // Append flag.
  bool overflowed;           // True if output gets overflowed.
  uint32 local_level;
  uint32 expr_level;
  uint32 arg_level;
};

// We don't use strlen() in libc since it's not guaranteed to be async
// signal safe.
size_t StrLen(const char* str) {
  size_t len = 0;
  while (*str != '\0') {
    ++str;
    ++len;
  }
  return len;
}

// Returns true if "str" has at least "n" characters remaining.
bool AtLeastNumCharsRemaining(const char* str, ssize_t n) {
  for (ssize_t i = 0; i < n; ++i) {
    if (str[i] == '\0') {
      return false;
    }
  }
  return true;
}

// Returns true if "str" has "prefix" as a prefix.
bool StrPrefix(const char* str, const char* prefix) {
  size_t i = 0;
  while (str[i] != '\0' && prefix[i] != '\0' && str[i] == prefix[i]) {
    ++i;
  }
  return prefix[i] == '\0';  // Consumed everything in "prefix".
}

void InitState(State* state, const char* mangled, char* out, size_t out_size) {
  state->mangled_cur = mangled;
  state->out_cur = out;
  state->out_begin = out;
  state->out_end = out + out_size;
  state->prev_name = nullptr;
  state->prev_name_length = -1;
  state->nest_level = -1;
  state->append = true;
  state->overflowed = false;
  state->local_level = 0;
  state->expr_level = 0;
  state->arg_level = 0;
}

// Returns true and advances "mangled_cur" if we find "one_char_token"
// at "mangled_cur" position.  It is assumed that "one_char_token" does
// not contain '\0'.
bool ParseOneCharToken(State* state, const char one_char_token) {
  if (state->mangled_cur[0] == one_char_token) {
    ++state->mangled_cur;
    return true;
  }
  return false;
}

// Returns true and advances "mangled_cur" if we find "two_char_token"
// at "mangled_cur" position.  It is assumed that "two_char_token" does
// not contain '\0'.
bool ParseTwoCharToken(State* state, const char* two_char_token) {
  if (state->mangled_cur[0] == two_char_token[0] &&
      state->mangled_cur[1] == two_char_token[1]) {
    state->mangled_cur += 2;
    return true;
  }
  return false;
}

// Returns true and advances "mangled_cur" if we find any character in
// "char_class" at "mangled_cur" position.
bool ParseCharClass(State* state, const char* char_class) {
  const char* p = char_class;
  for (; *p != '\0'; ++p) {
    if (state->mangled_cur[0] == *p) {
      ++state->mangled_cur;
      return true;
    }
  }
  return false;
}

// This function is used for handling an optional non-terminal.
bool Optional(bool) { return true; }

// This function is used for handling <non-terminal>+ syntax.
using ParseFunc = bool (*)(State*);
bool OneOrMore(ParseFunc parse_func, State* state) {
  if (parse_func(state)) {
    while (parse_func(state)) {
    }
    return true;
  }
  return false;
}

// This function is used for handling <non-terminal>* syntax. The function
// always returns true and must be followed by a termination token or a
// terminating sequence not handled by parse_func (e.g.
// ParseOneCharToken(state, 'E')).
bool ZeroOrMore(ParseFunc parse_func, State* state) {
  while (parse_func(state)) {
  }
  return true;
}

// Append "str" at "out_cur".  If there is an overflow, "overflowed"
// is set to true for later use.  The output string is ensured to
// always terminate with '\0' as long as there is no overflow.
void Append(State* state, const char* const str, ssize_t length) {
  if (state->out_cur == nullptr) {
    state->overflowed = true;
    return;
  }
  for (ssize_t i = 0; i < length; ++i) {
    if (state->out_cur + 1 < state->out_end) {  // +1 for '\0'
      *state->out_cur = str[i];
      ++state->out_cur;
    } else {
      state->overflowed = true;
      break;
    }
  }
  if (!state->overflowed) {
    *state->out_cur = '\0';  // Terminate it with '\0'
  }
}

// We don't use equivalents in libc to avoid locale issues.
bool IsLower(char c) { return c >= 'a' && c <= 'z'; }

bool IsAlpha(char c) {
  return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
}

bool IsDigit(char c) { return c >= '0' && c <= '9'; }

// Returns true if "str" is a function clone suffix.  These suffixes are used
// by GCC 4.5.x and later versions to indicate functions which have been
// cloned during optimization.  We treat any sequence (.<alpha>+.<digit>+)+ as
// a function clone suffix.
bool IsFunctionCloneSuffix(const char* str) {
  size_t i = 0;
  while (str[i] != '\0') {
    // Consume a single .<alpha>+.<digit>+ sequence.
    if (str[i] != '.' || !IsAlpha(str[i + 1])) {
      return false;
    }
    i += 2;
    while (IsAlpha(str[i])) {
      ++i;
    }
    if (str[i] != '.' || !IsDigit(str[i + 1])) {
      return false;
    }
    i += 2;
    while (IsDigit(str[i])) {
      ++i;
    }
  }
  return true;  // Consumed everything in "str".
}

// Append "str" with some tweaks, iff "append" state is true.
// Returns true so that it can be placed in "if" conditions.
void MaybeAppendWithLength(State* state, const char* const str,
                           ssize_t length) {
  if (state->append && length > 0) {
    // Append a space if the output buffer ends with '<' and "str"
    // starts with '<' to avoid <<<.
    if (str[0] == '<' && state->out_begin < state->out_cur &&
        state->out_cur[-1] == '<') {
      Append(state, " ", 1);
    }
    // Remember the last identifier name for ctors/dtors.
    if (IsAlpha(str[0]) || str[0] == '_') {
      state->prev_name = state->out_cur;
      state->prev_name_length = length;
    }
    Append(state, str, length);
  }
}

// A convenient wrapper around MaybeAppendWithLength().
bool MaybeAppend(State* state, const char* const str) {
  if (state->append) {
    size_t length = StrLen(str);
    MaybeAppendWithLength(state, str, static_cast<ssize_t>(length));
  }
  return true;
}

// This function is used for handling nested names.
bool EnterNestedName(State* state) {
  state->nest_level = 0;
  return true;
}

// This function is used for handling nested names.
bool LeaveNestedName(State* state, short prev_value) {
  state->nest_level = prev_value;
  return true;
}

// Disable the append mode not to print function parameters, etc.
bool DisableAppend(State* state) {
  state->append = false;
  return true;
}

// Restore the append mode to the previous state.
bool RestoreAppend(State* state, bool prev_value) {
  state->append = prev_value;
  return true;
}

// Increase the nest level for nested names.
void MaybeIncreaseNestLevel(State* state) {
  if (state->nest_level > -1) {
    ++state->nest_level;
  }
}

// Appends :: for nested names if necessary.
void MaybeAppendSeparator(State* state) {
  if (state->nest_level >= 1) {
    MaybeAppend(state, "::");
  }
}

// Cancel the last separator if necessary.
void MaybeCancelLastSeparator(State* state) {
  if (state->nest_level >= 1 && state->append &&
      state->out_begin <= state->out_cur - 2) {
    state->out_cur -= 2;
    *state->out_cur = '\0';
  }
}

// Returns true if the identifier of the given length pointed to by
// "mangled_cur" is anonymous namespace.
bool IdentifierIsAnonymousNamespace(State* state, ssize_t length) {
  const char anon_prefix[] = "_GLOBAL__N_";
  return (length > static_cast<ssize_t>(sizeof(anon_prefix)) -
                       1 &&  // Should be longer.
          StrPrefix(state->mangled_cur, anon_prefix));
}

// Forward declarations of our parsing functions.
bool ParseMangledName(State* state);
bool ParseEncoding(State* state);
bool ParseName(State* state);
bool ParseUnscopedName(State* state);
bool ParseUnscopedTemplateName(State* state);
bool ParseNestedName(State* state);
bool ParsePrefix(State* state);
bool ParseUnqualifiedName(State* state);
bool ParseSourceName(State* state);
bool ParseLocalSourceName(State* state);
bool ParseNumber(State* state, int* number_out);
bool ParseFloatNumber(State* state);
bool ParseSeqId(State* state);
bool ParseIdentifier(State* state, ssize_t length);
bool ParseAbiTags(State* state);
bool ParseAbiTag(State* state);
bool ParseOperatorName(State* state);
bool ParseSpecialName(State* state);
bool ParseCallOffset(State* state);
bool ParseNVOffset(State* state);
bool ParseVOffset(State* state);
bool ParseCtorDtorName(State* state);
bool ParseType(State* state);
bool ParseCVQualifiers(State* state);
bool ParseBuiltinType(State* state);
bool ParseFunctionType(State* state);
bool ParseBareFunctionType(State* state);
bool ParseClassEnumType(State* state);
bool ParseArrayType(State* state);
bool ParsePointerToMemberType(State* state);
bool ParseTemplateParam(State* state);
bool ParseTemplateTemplateParam(State* state);
bool ParseTemplateArgs(State* state);
bool ParseTemplateArg(State* state);
bool ParseExpression(State* state);
bool ParseExprPrimary(State* state);
bool ParseLocalName(State* state);
bool ParseDiscriminator(State* state);
bool ParseSubstitution(State* state);

// Implementation note: the following code is a straightforward
// translation of the Itanium C++ ABI defined in BNF with a couple of
// exceptions.
//
// - Support GNU extensions not defined in the Itanium C++ ABI
// - <prefix> and <template-prefix> are combined to avoid infinite loop
// - Reorder patterns to shorten the code
// - Reorder patterns to give greedier functions precedence
//   We'll mark "Less greedy than" for these cases in the code
//
// Each parsing function changes the state and returns true on
// success.  Otherwise, don't change the state and returns false.  To
// ensure that the state isn't changed in the latter case, we save the
// original state before we call more than one parsing functions
// consecutively with &&, and restore the state if unsuccessful.  See
// ParseEncoding() as an example of this convention.  We follow the
// convention throughout the code.
//
// Originally we tried to do demangling without following the full ABI
// syntax but it turned out we needed to follow the full syntax to
// parse complicated cases like nested template arguments.  Note that
// implementing a full-fledged demangler isn't trivial (libiberty's
// cp-demangle.c has +4300 lines).
//
// Note that (foo) in <(foo) ...> is a modifier to be ignored.
//
// Reference:
// - Itanium C++ ABI
//   <http://www.codesourcery.com/cxx-abi/abi.html#mangling>

// <mangled-name> ::= _Z <encoding>
bool ParseMangledName(State* state) {
  return ParseTwoCharToken(state, "_Z") && ParseEncoding(state);
}

// <encoding> ::= <(function) name> <bare-function-type>
//            ::= <(data) name>
//            ::= <special-name>
bool ParseEncoding(State* state) {
  State copy = *state;
  if (ParseName(state) && ParseBareFunctionType(state)) {
    return true;
  }
  *state = copy;

  if (ParseName(state) || ParseSpecialName(state)) {
    return true;
  }
  return false;
}

// <name> ::= <nested-name>
//        ::= <unscoped-template-name> <template-args>
//        ::= <unscoped-name>
//        ::= <local-name>
bool ParseName(State* state) {
  if (ParseNestedName(state) || ParseLocalName(state)) {
    return true;
  }

  State copy = *state;
  if (ParseUnscopedTemplateName(state) && ParseTemplateArgs(state)) {
    return true;
  }
  *state = copy;

  // Less greedy than <unscoped-template-name> <template-args>.
  if (ParseUnscopedName(state)) {
    return true;
  }
  return false;
}

// <unscoped-name> ::= <unqualified-name>
//                 ::= St <unqualified-name>
bool ParseUnscopedName(State* state) {
  if (ParseUnqualifiedName(state)) {
    return true;
  }

  State copy = *state;
  if (ParseTwoCharToken(state, "St") && MaybeAppend(state, "std::") &&
      ParseUnqualifiedName(state)) {
    return true;
  }
  *state = copy;
  return false;
}

// <unscoped-template-name> ::= <unscoped-name>
//                          ::= <substitution>
bool ParseUnscopedTemplateName(State* state) {
  return ParseUnscopedName(state) || ParseSubstitution(state);
}

// <nested-name> ::= N [<CV-qualifiers>] <prefix> <unqualified-name> E
//               ::= N [<CV-qualifiers>] <template-prefix> <template-args> E
bool ParseNestedName(State* state) {
  State copy = *state;
  if (ParseOneCharToken(state, 'N') && EnterNestedName(state) &&
      Optional(ParseCVQualifiers(state)) && ParsePrefix(state) &&
      LeaveNestedName(state, copy.nest_level) &&
      ParseOneCharToken(state, 'E')) {
    return true;
  }
  *state = copy;
  return false;
}

// This part is tricky.  If we literally translate them to code, we'll
// end up infinite loop.  Hence we merge them to avoid the case.
//
// <prefix> ::= <prefix> <unqualified-name>
//          ::= <template-prefix> <template-args>
//          ::= <template-param>
//          ::= <substitution>
//          ::= # empty
// <template-prefix> ::= <prefix> <(template) unqualified-name>
//                   ::= <template-param>
//                   ::= <substitution>
bool ParsePrefix(State* state) {
  bool has_something = false;
  while (true) {
    MaybeAppendSeparator(state);
    if (ParseTemplateParam(state) || ParseSubstitution(state) ||
        ParseUnscopedName(state)) {
      has_something = true;
      MaybeIncreaseNestLevel(state);
      continue;
    }
    MaybeCancelLastSeparator(state);
    if (has_something && ParseTemplateArgs(state)) {
      return ParsePrefix(state);
    } else {
      break;
    }
  }
  return true;
}

// <unqualified-name> ::= <operator-name>
//                    ::= <ctor-dtor-name>
//                    ::= <source-name> [<abi-tags>]
//                    ::= <local-source-name> [<abi-tags>]
bool ParseUnqualifiedName(State* state) {
  return (ParseOperatorName(state) || ParseCtorDtorName(state) ||
          (ParseSourceName(state) && Optional(ParseAbiTags(state))) ||
          (ParseLocalSourceName(state) && Optional(ParseAbiTags(state))));
}

// <source-name> ::= <positive length number> <identifier>
bool ParseSourceName(State* state) {
  State copy = *state;
  int length = -1;
  if (ParseNumber(state, &length) && ParseIdentifier(state, length)) {
    return true;
  }
  *state = copy;
  return false;
}

// <local-source-name> ::= L <source-name> [<discriminator>]
//
// References:
//   http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31775
//   http://gcc.gnu.org/viewcvs?view=rev&revision=124467
bool ParseLocalSourceName(State* state) {
  State copy = *state;
  if (ParseOneCharToken(state, 'L') && ParseSourceName(state) &&
      Optional(ParseDiscriminator(state))) {
    return true;
  }
  *state = copy;
  return false;
}

// <number> ::= [n] <non-negative decimal integer>
// If "number_out" is non-null, then *number_out is set to the value of the
// parsed number on success.
bool ParseNumber(State* state, int* number_out) {
  int sign = 1;
  if (ParseOneCharToken(state, 'n')) {
    sign = -1;
  }
  const char* p = state->mangled_cur;
  int number = 0;
  constexpr int int_max_by_10 = std::numeric_limits<int>::max() / 10;
  for (; *p != '\0'; ++p) {
    if (IsDigit(*p)) {
      // Prevent signed integer overflow when multiplying
      if (number > int_max_by_10) {
        return false;
      }

      const int digit = *p - '0';
      const int shifted = number * 10;

      // Prevent signed integer overflow when summing
      if (digit > std::numeric_limits<int>::max() - shifted) {
        return false;
      }

      number = shifted + digit;
    } else {
      break;
    }
  }
  if (p != state->mangled_cur) {  // Conversion succeeded.
    state->mangled_cur = p;
    if (number_out != nullptr) {
      *number_out = number * sign;
    }
    return true;
  }
  return false;
}

// Floating-point literals are encoded using a fixed-length lowercase
// hexadecimal string.
bool ParseFloatNumber(State* state) {
  const char* p = state->mangled_cur;
  for (; *p != '\0'; ++p) {
    if (!IsDigit(*p) && !(*p >= 'a' && *p <= 'f')) {
      break;
    }
  }
  if (p != state->mangled_cur) {  // Conversion succeeded.
    state->mangled_cur = p;
    return true;
  }
  return false;
}

// The <seq-id> is a sequence number in base 36,
// using digits and upper case letters
bool ParseSeqId(State* state) {
  const char* p = state->mangled_cur;
  for (; *p != '\0'; ++p) {
    if (!IsDigit(*p) && !(*p >= 'A' && *p <= 'Z')) {
      break;
    }
  }
  if (p != state->mangled_cur) {  // Conversion succeeded.
    state->mangled_cur = p;
    return true;
  }
  return false;
}

// <identifier> ::= <unqualified source code identifier> (of given length)
bool ParseIdentifier(State* state, ssize_t length) {
  if (length == -1 || !AtLeastNumCharsRemaining(state->mangled_cur, length)) {
    return false;
  }
  if (IdentifierIsAnonymousNamespace(state, length)) {
    MaybeAppend(state, "(anonymous namespace)");
  } else {
    MaybeAppendWithLength(state, state->mangled_cur, length);
  }
  if (length < 0 ||
      static_cast<std::size_t>(length) > StrLen(state->mangled_cur)) {
    return false;
  }
  state->mangled_cur += length;
  return true;
}

// <abi-tags> ::= <abi-tag> [<abi-tags>]
bool ParseAbiTags(State* state) {
  State copy = *state;
  DisableAppend(state);
  if (OneOrMore(ParseAbiTag, state)) {
    RestoreAppend(state, copy.append);
    return true;
  }
  *state = copy;
  return false;
}

// <abi-tag> ::= B <source-name>
bool ParseAbiTag(State* state) {
  return ParseOneCharToken(state, 'B') && ParseSourceName(state);
}

// <operator-name> ::= nw, and other two letters cases
//                 ::= cv <type>  # (cast)
//                 ::= v  <digit> <source-name> # vendor extended operator
bool ParseOperatorName(State* state) {
  if (!AtLeastNumCharsRemaining(state->mangled_cur, 2)) {
    return false;
  }
  // First check with "cv" (cast) case.
  State copy = *state;
  if (ParseTwoCharToken(state, "cv") && MaybeAppend(state, "operator ") &&
      EnterNestedName(state) && ParseType(state) &&
      LeaveNestedName(state, copy.nest_level)) {
    return true;
  }
  *state = copy;

  // Then vendor extended operators.
  if (ParseOneCharToken(state, 'v') && ParseCharClass(state, "0123456789") &&
      ParseSourceName(state)) {
    return true;
  }
  *state = copy;

  // Other operator names should start with a lower alphabet followed
  // by a lower/upper alphabet.
  if (!(IsLower(state->mangled_cur[0]) && IsAlpha(state->mangled_cur[1]))) {
    return false;
  }
  // We may want to perform a binary search if we really need speed.
  const AbbrevPair* p;
  for (p = kOperatorList; p->abbrev != nullptr; ++p) {
    if (state->mangled_cur[0] == p->abbrev[0] &&
        state->mangled_cur[1] == p->abbrev[1]) {
      MaybeAppend(state, "operator");
      if (IsLower(*p->real_name)) {  // new, delete, etc.
        MaybeAppend(state, " ");
      }
      MaybeAppend(state, p->real_name);
      state->mangled_cur += 2;
      return true;
    }
  }
  return false;
}

// <special-name> ::= TV <type>
//                ::= TT <type>
//                ::= TI <type>
//                ::= TS <type>
//                ::= Tc <call-offset> <call-offset> <(base) encoding>
//                ::= GV <(object) name>
//                ::= T <call-offset> <(base) encoding>
// G++ extensions:
//                ::= TC <type> <(offset) number> _ <(base) type>
//                ::= TF <type>
//                ::= TJ <type>
//                ::= GR <name>
//                ::= GA <encoding>
//                ::= Th <call-offset> <(base) encoding>
//                ::= Tv <call-offset> <(base) encoding>
//
// Note: we don't care much about them since they don't appear in
// stack traces.  The are special data.
bool ParseSpecialName(State* state) {
  State copy = *state;
  if (ParseOneCharToken(state, 'T') && ParseCharClass(state, "VTIS") &&
      ParseType(state)) {
    return true;
  }
  *state = copy;

  if (ParseTwoCharToken(state, "Tc") && ParseCallOffset(state) &&
      ParseCallOffset(state) && ParseEncoding(state)) {
    return true;
  }
  *state = copy;

  if (ParseTwoCharToken(state, "GV") && ParseName(state)) {
    return true;
  }
  *state = copy;

  if (ParseOneCharToken(state, 'T') && ParseCallOffset(state) &&
      ParseEncoding(state)) {
    return true;
  }
  *state = copy;

  // G++ extensions
  if (ParseTwoCharToken(state, "TC") && ParseType(state) &&
      ParseNumber(state, nullptr) && ParseOneCharToken(state, '_') &&
      DisableAppend(state) && ParseType(state)) {
    RestoreAppend(state, copy.append);
    return true;
  }
  *state = copy;

  if (ParseOneCharToken(state, 'T') && ParseCharClass(state, "FJ") &&
      ParseType(state)) {
    return true;
  }
  *state = copy;

  if (ParseTwoCharToken(state, "GR") && ParseName(state)) {
    return true;
  }
  *state = copy;

  if (ParseTwoCharToken(state, "GA") && ParseEncoding(state)) {
    return true;
  }
  *state = copy;

  if (ParseOneCharToken(state, 'T') && ParseCharClass(state, "hv") &&
      ParseCallOffset(state) && ParseEncoding(state)) {
    return true;
  }
  *state = copy;
  return false;
}

// <call-offset> ::= h <nv-offset> _
//               ::= v <v-offset> _
bool ParseCallOffset(State* state) {
  State copy = *state;
  if (ParseOneCharToken(state,
Download .txt
gitextract_hlt6jbbs/

├── .bazelci/
│   └── presubmit.yml
├── .clang-format
├── .clang-tidy
├── .gitattributes
├── .github/
│   ├── dependabot.yml
│   └── workflows/
│       ├── android.yml
│       ├── cifuzz.yml
│       ├── emscripten.yml
│       ├── linux.yml
│       ├── macos.yml
│       └── windows.yml
├── .gitignore
├── AUTHORS
├── BUILD.bazel
├── CMakeLists.txt
├── CONTRIBUTORS
├── ChangeLog
├── LICENSE.md
├── MODULE.bazel
├── README.rst
├── WORKSPACE.bazel
├── bazel/
│   ├── example/
│   │   ├── BUILD.bazel
│   │   └── main.cc
│   └── glog.bzl
├── cmake/
│   ├── DetermineGflagsNamespace.cmake
│   ├── FindUnwind.cmake
│   ├── GetCacheVariables.cmake
│   ├── RunCleanerTest1.cmake
│   ├── RunCleanerTest2.cmake
│   ├── RunCleanerTest3.cmake
│   ├── TestInitPackageConfig.cmake
│   └── TestPackageConfig.cmake
├── codecov.yml
├── docs/
│   ├── build.md
│   ├── contribute.md
│   ├── failures.md
│   ├── flags.md
│   ├── index.md
│   ├── license.md
│   ├── log_cleaner.md
│   ├── log_stripping.md
│   ├── logging.md
│   ├── overrides/
│   │   └── main.html
│   ├── packages.md
│   ├── requirements.txt
│   ├── sinks.md
│   ├── unwinder.md
│   ├── usage.md
│   └── windows.md
├── examples/
│   └── custom_sink.cc
├── gcovr.cfg
├── glog-config.cmake.in
├── glog-modules.cmake.in
├── libglog.pc.in
├── mkdocs.yml
└── src/
    ├── base/
    │   ├── commandlineflags.h
    │   └── googleinit.h
    ├── cleanup_immediately_unittest.cc
    ├── cleanup_with_absolute_prefix_unittest.cc
    ├── cleanup_with_relative_prefix_unittest.cc
    ├── config.h.cmake.in
    ├── dcheck_unittest/
    │   ├── CMakeLists.txt
    │   └── glog_dcheck.cc
    ├── demangle.cc
    ├── demangle.h
    ├── demangle_unittest.cc
    ├── demangle_unittest.sh
    ├── demangle_unittest.txt
    ├── flags.cc
    ├── fuzz_demangle.cc
    ├── glog/
    │   ├── flags.h
    │   ├── log_severity.h
    │   ├── logging.h
    │   ├── platform.h
    │   ├── raw_logging.h
    │   ├── stl_logging.h
    │   ├── types.h
    │   └── vlog_is_on.h
    ├── googletest.h
    ├── includes_unittest/
    │   ├── CMakeLists.txt
    │   ├── glog_includes_logging.cc
    │   ├── glog_includes_raw_logging.cc
    │   ├── glog_includes_stl_logging.cc
    │   └── glog_includes_vlog_is_on.cc
    ├── log_severity_unittest/
    │   ├── CMakeLists.txt
    │   ├── glog_log_severity_constants.cc
    │   └── glog_log_severity_conversion.cc
    ├── logging.cc
    ├── logging_striplog_test.sh
    ├── logging_unittest.cc
    ├── logging_unittest.err
    ├── logging_unittest.out
    ├── mock-log.h
    ├── mock-log_unittest.cc
    ├── package_config_unittest/
    │   └── working_config/
    │       ├── CMakeLists.txt
    │       └── glog_package_config.cc
    ├── raw_logging.cc
    ├── signalhandler.cc
    ├── signalhandler_unittest.cc
    ├── signalhandler_unittest.sh
    ├── stacktrace.cc
    ├── stacktrace.h
    ├── stacktrace_generic-inl.h
    ├── stacktrace_libunwind-inl.h
    ├── stacktrace_powerpc-inl.h
    ├── stacktrace_unittest.cc
    ├── stacktrace_unwind-inl.h
    ├── stacktrace_windows-inl.h
    ├── stacktrace_x86-inl.h
    ├── stl_logging_unittest.cc
    ├── striplog_unittest.cc
    ├── symbolize.cc
    ├── symbolize.h
    ├── symbolize_unittest.cc
    ├── utilities.cc
    ├── utilities.h
    ├── utilities_unittest.cc
    ├── vlog_is_on.cc
    └── windows/
        ├── dirent.h
        ├── port.cc
        └── port.h
Download .txt
SYMBOL INDEX (506 symbols across 53 files)

FILE: bazel/example/main.cc
  function main (line 5) | int main(int argc, char* argv[]) {

FILE: examples/custom_sink.cc
  type MyLogSink (line 42) | struct MyLogSink : google::LogSink {  // (1)!
    method send (line 43) | void send(google::LogSeverity severity, const char* /*full_filename*/,
  function main (line 57) | int main(int /*argc*/, char** argv) {

FILE: src/base/googleinit.h
  function class (line 36) | class GoogleInitializer {

FILE: src/cleanup_immediately_unittest.cc
  function TEST (line 57) | TEST(CleanImmediately, logging) {
  function main (line 69) | int main(int argc, char** argv) {

FILE: src/cleanup_with_absolute_prefix_unittest.cc
  function TEST (line 57) | TEST(CleanImmediatelyWithAbsolutePrefix, logging) {
  function main (line 74) | int main(int argc, char** argv) {

FILE: src/cleanup_with_relative_prefix_unittest.cc
  function TEST (line 57) | TEST(CleanImmediatelyWithRelativePrefix, logging) {
  function main (line 70) | int main(int argc, char** argv) {

FILE: src/dcheck_unittest/glog_dcheck.cc
  function main (line 34) | int main(int /*argc*/, char** argv) {

FILE: src/demangle.cc
  type google (line 53) | namespace google {
    type glog_internal_namespace_ (line 54) | inline namespace glog_internal_namespace_ {
      type AbbrevPair (line 58) | struct AbbrevPair {
      type State (line 111) | struct State {
      function StrLen (line 128) | size_t StrLen(const char* str) {
      function AtLeastNumCharsRemaining (line 138) | bool AtLeastNumCharsRemaining(const char* str, ssize_t n) {
      function StrPrefix (line 148) | bool StrPrefix(const char* str, const char* prefix) {
      function InitState (line 156) | void InitState(State* state, const char* mangled, char* out, size_t ...
      function ParseOneCharToken (line 174) | bool ParseOneCharToken(State* state, const char one_char_token) {
      function ParseTwoCharToken (line 185) | bool ParseTwoCharToken(State* state, const char* two_char_token) {
      function ParseCharClass (line 196) | bool ParseCharClass(State* state, const char* char_class) {
      function Optional (line 208) | bool Optional(bool) { return true; }
      function OneOrMore (line 212) | bool OneOrMore(ParseFunc parse_func, State* state) {
      function ZeroOrMore (line 225) | bool ZeroOrMore(ParseFunc parse_func, State* state) {
      function Append (line 234) | void Append(State* state, const char* const str, ssize_t length) {
      function IsLower (line 254) | bool IsLower(char c) { return c >= 'a' && c <= 'z'; }
      function IsAlpha (line 256) | bool IsAlpha(char c) {
      function IsDigit (line 260) | bool IsDigit(char c) { return c >= '0' && c <= '9'; }
      function IsFunctionCloneSuffix (line 266) | bool IsFunctionCloneSuffix(const char* str) {
      function MaybeAppendWithLength (line 290) | void MaybeAppendWithLength(State* state, const char* const str,
      function MaybeAppend (line 309) | bool MaybeAppend(State* state, const char* const str) {
      function EnterNestedName (line 318) | bool EnterNestedName(State* state) {
      function LeaveNestedName (line 324) | bool LeaveNestedName(State* state, short prev_value) {
      function DisableAppend (line 330) | bool DisableAppend(State* state) {
      function RestoreAppend (line 336) | bool RestoreAppend(State* state, bool prev_value) {
      function MaybeIncreaseNestLevel (line 342) | void MaybeIncreaseNestLevel(State* state) {
      function MaybeAppendSeparator (line 349) | void MaybeAppendSeparator(State* state) {
      function MaybeCancelLastSeparator (line 356) | void MaybeCancelLastSeparator(State* state) {
      function IdentifierIsAnonymousNamespace (line 366) | bool IdentifierIsAnonymousNamespace(State* state, ssize_t length) {
      function ParseMangledName (line 445) | bool ParseMangledName(State* state) {
      function ParseEncoding (line 452) | bool ParseEncoding(State* state) {
      function ParseName (line 469) | bool ParseName(State* state) {
      function ParseUnscopedName (line 489) | bool ParseUnscopedName(State* state) {
      function ParseUnscopedTemplateName (line 505) | bool ParseUnscopedTemplateName(State* state) {
      function ParseNestedName (line 511) | bool ParseNestedName(State* state) {
      function ParsePrefix (line 534) | bool ParsePrefix(State* state) {
      function ParseUnqualifiedName (line 558) | bool ParseUnqualifiedName(State* state) {
      function ParseSourceName (line 565) | bool ParseSourceName(State* state) {
      function ParseLocalSourceName (line 580) | bool ParseLocalSourceName(State* state) {
      function ParseNumber (line 593) | bool ParseNumber(State* state, int* number_out) {
      function ParseFloatNumber (line 633) | bool ParseFloatNumber(State* state) {
      function ParseSeqId (line 649) | bool ParseSeqId(State* state) {
      function ParseIdentifier (line 664) | bool ParseIdentifier(State* state, ssize_t length) {
      function ParseAbiTags (line 682) | bool ParseAbiTags(State* state) {
      function ParseAbiTag (line 694) | bool ParseAbiTag(State* state) {
      function ParseOperatorName (line 701) | bool ParseOperatorName(State* state) {
      function ParseSpecialName (line 761) | bool ParseSpecialName(State* state) {
      function ParseCallOffset (line 821) | bool ParseCallOffset(State* state) {
      function ParseNVOffset (line 839) | bool ParseNVOffset(State* state) { return ParseNumber(state, nullptr...
      function ParseVOffset (line 842) | bool ParseVOffset(State* state) {
      function ParseCtorDtorName (line 854) | bool ParseCtorDtorName(State* state) {
      function ParseType (line 895) | bool ParseType(State* state) {
      function ParseCVQualifiers (line 947) | bool ParseCVQualifiers(State* state) {
      function ParseBuiltinType (line 957) | bool ParseBuiltinType(State* state) {
      function ParseFunctionType (line 976) | bool ParseFunctionType(State* state) {
      function ParseBareFunctionType (line 988) | bool ParseBareFunctionType(State* state) {
      function ParseClassEnumType (line 1001) | bool ParseClassEnumType(State* state) { return ParseName(state); }
      function ParseArrayType (line 1005) | bool ParseArrayType(State* state) {
      function ParsePointerToMemberType (line 1022) | bool ParsePointerToMemberType(State* state) {
      function ParseTemplateParam (line 1033) | bool ParseTemplateParam(State* state) {
      function ParseTemplateTemplateParam (line 1051) | bool ParseTemplateTemplateParam(State* state) {
      function ParseTemplateArgs (line 1056) | bool ParseTemplateArgs(State* state) {
      function ParseTemplateArg (line 1074) | bool ParseTemplateArg(State* state) {
      function ParseExpression (line 1115) | bool ParseExpression(State* state) {
      function ParseExprPrimary (line 1184) | bool ParseExprPrimary(State* state) {
      function ParseLocalName (line 1216) | bool ParseLocalName(State* state) {
      function ParseDiscriminator (line 1243) | bool ParseDiscriminator(State* state) {
      function ParseSubstitution (line 1255) | bool ParseSubstitution(State* state) {
      function ParseTopLevelMangledName (line 1290) | bool ParseTopLevelMangledName(State* state) {
      function Demangle (line 1313) | bool Demangle(const char* mangled, char* out, size_t out_size) {

FILE: src/demangle.h
  function namespace (line 83) | namespace google {

FILE: src/demangle_unittest.cc
  function TEST (line 69) | TEST(Demangle, Windows) {
  function TEST (line 82) | TEST(Demangle, CornerCases) {
  function TEST (line 102) | TEST(Demangle, Clones) {
  function TEST (line 124) | TEST(Demangle, FromFile) {
  function main (line 147) | int main(int argc, char** argv) {

FILE: src/flags.cc
  function BoolFromEnv (line 53) | bool BoolFromEnv(const char* varname, bool defval) {

FILE: src/fuzz_demangle.cc
  function LLVMFuzzerTestOneInput (line 21) | int LLVMFuzzerTestOneInput(const unsigned char* Data,

FILE: src/glog/log_severity.h
  function namespace (line 41) | namespace google {

FILE: src/glog/logging.h
  function namespace (line 80) | namespace google {
  function namespace (line 453) | namespace google {
  function namespace (line 879) | namespace google {
  function class (line 1459) | class GLOG_EXPORT LogSink {
  function namespace (line 1567) | namespace base {

FILE: src/glog/raw_logging.h
  function namespace (line 50) | namespace google {

FILE: src/glog/stl_logging.h
  function namespace (line 58) | namespace google {
  function namespace (line 124) | namespace google {
  function namespace (line 164) | namespace std {

FILE: src/glog/types.h
  function namespace (line 38) | namespace google {

FILE: src/glog/vlog_is_on.h
  function namespace (line 101) | namespace google {

FILE: src/googletest.h
  function namespace (line 75) | namespace google {
  function string (line 85) | static inline string GetTempDir() {
  function namespace (line 127) | namespace google {
  function namespace (line 238) | namespace google {
  function class (line 315) | class CapturedStream {
  function Capture (line 323) | void Capture() {
  function CaptureTestOutput (line 361) | static inline void CaptureTestOutput(int fd, const string& filename) {
  function CaptureTestStdout (line 366) | static inline void CaptureTestStdout() {
  function CaptureTestStderr (line 369) | static inline void CaptureTestStderr() {
  function GetFileSize (line 373) | static inline size_t GetFileSize(FILE* file) {
  function string (line 378) | static inline string ReadEntireFile(FILE* file) {
  function string (line 398) | static inline string GetCapturedTestOutput(int fd) {
  function throw (line 603) | throw std::bad_alloc{}
  function delete (line 612) | void operator delete(void* p) noexcept { free(p); }
  function delete (line 614) | void operator delete(void* p, size_t) noexcept { ::operator delete(p); }
  function noexcept (line 616) | void operator delete[](void* p) noexcept { ::operator delete(p); }
  function noexcept (line 618) | void operator delete[](void* p, size_t) noexcept { ::operator delete(p); }

FILE: src/includes_unittest/glog_includes_logging.cc
  function main (line 34) | int main() {

FILE: src/includes_unittest/glog_includes_raw_logging.cc
  function main (line 34) | int main() {

FILE: src/includes_unittest/glog_includes_stl_logging.cc
  function main (line 34) | int main() {}

FILE: src/includes_unittest/glog_includes_vlog_is_on.cc
  function main (line 34) | int main() { VLOG_IS_ON(0); }

FILE: src/log_severity_unittest/glog_log_severity_constants.cc
  function main (line 34) | int main() {

FILE: src/log_severity_unittest/glog_log_severity_conversion.cc
  function main (line 34) | int main() {

FILE: src/logging.cc
  function pread (line 129) | static ssize_t pread(int fd, void* buf, size_t count, off_t offset) {
  function pwrite (line 141) | static ssize_t pwrite(int fd, void* buf, size_t count, off_t offset) {
  function GetHostName (line 152) | static void GetHostName(string* hostname) {
  function TerminalSupportsColor (line 175) | static bool TerminalSupportsColor() {
  type GLogColor (line 221) | enum GLogColor { COLOR_DEFAULT, COLOR_RED, COLOR_GREEN, COLOR_YELLOW }
  function GLogColor (line 223) | static GLogColor SeverityToColor(LogSeverity severity) {
  function WORD (line 241) | static WORD GetColorAttribute(GLogColor color) {
  function uint32 (line 275) | static uint32 MaxLogSize() {
  type logging (line 285) | namespace logging {
    type internal (line 286) | namespace internal {
      type LogMessageData (line 287) | struct LogMessageData {
        method LogMessageData (line 312) | LogMessageData(const LogMessageData&) = delete;
        method LogMessageData (line 313) | LogMessageData& operator=(const LogMessageData&) = delete;
      function ostream (line 2573) | ostream* CheckOpMessageBuilder::ForVar2() {
      function MakeCheckOpValueString (line 2584) | void MakeCheckOpValueString(std::ostream* os, const char& v) {
      function MakeCheckOpValueString (line 2593) | void MakeCheckOpValueString(std::ostream* os, const signed char& v) {
      function MakeCheckOpValueString (line 2602) | void MakeCheckOpValueString(std::ostream* os, const unsigned char& v) {
      function MakeCheckOpValueString (line 2611) | void MakeCheckOpValueString(std::ostream* os, const std::nullptr_t& ...
    type internal (line 2453) | namespace internal {
      type LogMessageData (line 287) | struct LogMessageData {
        method LogMessageData (line 312) | LogMessageData(const LogMessageData&) = delete;
        method LogMessageData (line 313) | LogMessageData& operator=(const LogMessageData&) = delete;
      function ostream (line 2573) | ostream* CheckOpMessageBuilder::ForVar2() {
      function MakeCheckOpValueString (line 2584) | void MakeCheckOpValueString(std::ostream* os, const char& v) {
      function MakeCheckOpValueString (line 2593) | void MakeCheckOpValueString(std::ostream* os, const signed char& v) {
      function MakeCheckOpValueString (line 2602) | void MakeCheckOpValueString(std::ostream* os, const unsigned char& v) {
      function MakeCheckOpValueString (line 2611) | void MakeCheckOpValueString(std::ostream* os, const std::nullptr_t& ...
    type internal (line 2564) | namespace internal {
      type LogMessageData (line 287) | struct LogMessageData {
        method LogMessageData (line 312) | LogMessageData(const LogMessageData&) = delete;
        method LogMessageData (line 313) | LogMessageData& operator=(const LogMessageData&) = delete;
      function ostream (line 2573) | ostream* CheckOpMessageBuilder::ForVar2() {
      function MakeCheckOpValueString (line 2584) | void MakeCheckOpValueString(std::ostream* os, const char& v) {
      function MakeCheckOpValueString (line 2593) | void MakeCheckOpValueString(std::ostream* os, const signed char& v) {
      function MakeCheckOpValueString (line 2602) | void MakeCheckOpValueString(std::ostream* os, const unsigned char& v) {
      function MakeCheckOpValueString (line 2611) | void MakeCheckOpValueString(std::ostream* os, const std::nullptr_t& ...
  class PrefixFormatter (line 351) | class PrefixFormatter {
    method PrefixFormatter (line 353) | PrefixFormatter(PrefixFormatterCallback callback, void* data) noexcept
    method PrefixFormatter (line 364) | PrefixFormatter(const PrefixFormatter& other) = delete;
    method PrefixFormatter (line 365) | PrefixFormatter& operator=(const PrefixFormatter& other) = delete;
    type Version (line 368) | enum Version { V2 }
  class LogFileObject (line 379) | class LogFileObject : public base::Logger {
    method uint32 (line 399) | uint32 LogSize() override {
  class LogCleaner (line 434) | class LogCleaner {
    method enabled (line 446) | bool enabled() const { return enabled_; }
  class LogDestination (line 473) | class LogDestination {
    method ResetLoggerImpl (line 559) | void ResetLoggerImpl() { SetLoggerImpl(&fileobject_); }
    method LogDestination (line 578) | LogDestination(const LogDestination&) = delete;
    method LogDestination (line 579) | LogDestination& operator=(const LogDestination&) = delete;
  function string (line 594) | const string& LogDestination::hostname() {
  function ColoredWriteToStderrOrStdout (line 720) | static void ColoredWriteToStderrOrStdout(FILE* output, LogSeverity sever...
  function ColoredWriteToStdout (line 761) | static void ColoredWriteToStdout(LogSeverity severity, const char* message,
  function ColoredWriteToStderr (line 772) | static void ColoredWriteToStderr(LogSeverity severity, const char* message,
  function WriteToStderr (line 777) | static void WriteToStderr(const char* message, size_t len) {
  function LogDestination (line 879) | inline LogDestination* LogDestination::log_destination(LogSeverity sever...
    method ResetLoggerImpl (line 559) | void ResetLoggerImpl() { SetLoggerImpl(&fileobject_); }
    method LogDestination (line 578) | LogDestination(const LogDestination&) = delete;
    method LogDestination (line 579) | LogDestination& operator=(const LogDestination&) = delete;
  function SetApplicationFingerprint (line 901) | void SetApplicationFingerprint(const std::string& fingerprint) {
  function string (line 914) | string PrettyDuration(const std::chrono::duration<int>& secs) {
  type stat (line 1002) | struct stat
  type flock (line 1031) | struct flock
  type ::tm (line 1139) | struct ::tm
  type dirent (line 1362) | struct dirent
  type stat (line 1483) | struct stat
  function LogSeverity (line 1662) | LogSeverity LogMessage::severity() const noexcept { return data_->severi...
  function LogMessageTime (line 1670) | const LogMessageTime& LogMessage::time() const noexcept { return time_; }
  function ostream (line 1709) | ostream& LogMessage::stream() { return data_->stream_; }
  function ReprintFatalMessage (line 1773) | void ReprintFatalMessage() {
  function EXCLUSIVE_LOCKS_REQUIRED (line 1785) | EXCLUSIVE_LOCKS_REQUIRED(log_mutex) {
  function NullStream (line 1888) | NullStream& NullStream::stream() { return *this; }
  function logging_fail_func_t (line 1896) | logging_fail_func_t InstallFailureFunction(logging_fail_func_t fail_func) {
  function EXCLUSIVE_LOCKS_REQUIRED (line 1903) | EXCLUSIVE_LOCKS_REQUIRED(log_mutex) {
  function EXCLUSIVE_LOCKS_REQUIRED (line 1916) | EXCLUSIVE_LOCKS_REQUIRED(log_mutex) {
  function EXCLUSIVE_LOCKS_REQUIRED (line 1922) | EXCLUSIVE_LOCKS_REQUIRED(log_mutex) {
  function EXCLUSIVE_LOCKS_REQUIRED (line 1936) | EXCLUSIVE_LOCKS_REQUIRED(log_mutex) {
  function int64 (line 1982) | int64 LogMessage::num_messages(int severity) {
  function ostream (line 1989) | ostream& operator<<(ostream& os, const Counter_t&) {
  function FlushLogFiles (line 2013) | void FlushLogFiles(LogSeverity min_severity) {
  function FlushLogFilesUnsafe (line 2017) | void FlushLogFilesUnsafe(LogSeverity min_severity) {
  function SetLogDestination (line 2021) | void SetLogDestination(LogSeverity severity, const char* base_filename) {
  function SetLogSymlink (line 2025) | void SetLogSymlink(LogSeverity severity, const char* symlink_basename) {
  function string (line 2035) | string LogSink::ToString(LogSeverity severity, const char* file, int line,
  function AddLogSink (line 2057) | void AddLogSink(LogSink* destination) {
  function RemoveLogSink (line 2061) | void RemoveLogSink(LogSink* destination) {
  function SetLogFilenameExtension (line 2065) | void SetLogFilenameExtension(const char* ext) {
  function SetStderrLogging (line 2069) | void SetStderrLogging(LogSeverity min_severity) {
  function SetEmailLogging (line 2073) | void SetEmailLogging(LogSeverity min_severity, const char* addresses) {
  function LogToStderr (line 2077) | void LogToStderr() { LogDestination::LogToStderr(); }
  type base (line 2079) | namespace base {
    type internal (line 2080) | namespace internal {
      function GetExitOnDFatal (line 2083) | bool GetExitOnDFatal() {
      function SetExitOnDFatal (line 2099) | void SetExitOnDFatal(bool value) {
  function string (line 2114) | static string ShellEscape(const string& src) {
  function trim (line 2144) | static inline void trim(std::string& s) {
  function SendEmailInternal (line 2154) | static bool SendEmailInternal(const char* dest, const char* subject,
  function SendEmail (line 2257) | bool SendEmail(const char* dest, const char* subject, const char* body) {
  function GetTempDirectories (line 2261) | static void GetTempDirectories(vector<string>& list) {
  function GLOG_NO_EXPORT (line 2340) | GLOG_NO_EXPORT
  type stat (line 2357) | struct stat
  function TruncateStdoutStderr (line 2441) | void TruncateStdoutStderr() {
  type logging (line 2452) | namespace logging {
    type internal (line 286) | namespace internal {
      type LogMessageData (line 287) | struct LogMessageData {
        method LogMessageData (line 312) | LogMessageData(const LogMessageData&) = delete;
        method LogMessageData (line 313) | LogMessageData& operator=(const LogMessageData&) = delete;
      function ostream (line 2573) | ostream* CheckOpMessageBuilder::ForVar2() {
      function MakeCheckOpValueString (line 2584) | void MakeCheckOpValueString(std::ostream* os, const char& v) {
      function MakeCheckOpValueString (line 2593) | void MakeCheckOpValueString(std::ostream* os, const signed char& v) {
      function MakeCheckOpValueString (line 2602) | void MakeCheckOpValueString(std::ostream* os, const unsigned char& v) {
      function MakeCheckOpValueString (line 2611) | void MakeCheckOpValueString(std::ostream* os, const std::nullptr_t& ...
    type internal (line 2453) | namespace internal {
      type LogMessageData (line 287) | struct LogMessageData {
        method LogMessageData (line 312) | LogMessageData(const LogMessageData&) = delete;
        method LogMessageData (line 313) | LogMessageData& operator=(const LogMessageData&) = delete;
      function ostream (line 2573) | ostream* CheckOpMessageBuilder::ForVar2() {
      function MakeCheckOpValueString (line 2584) | void MakeCheckOpValueString(std::ostream* os, const char& v) {
      function MakeCheckOpValueString (line 2593) | void MakeCheckOpValueString(std::ostream* os, const signed char& v) {
      function MakeCheckOpValueString (line 2602) | void MakeCheckOpValueString(std::ostream* os, const unsigned char& v) {
      function MakeCheckOpValueString (line 2611) | void MakeCheckOpValueString(std::ostream* os, const std::nullptr_t& ...
    type internal (line 2564) | namespace internal {
      type LogMessageData (line 287) | struct LogMessageData {
        method LogMessageData (line 312) | LogMessageData(const LogMessageData&) = delete;
        method LogMessageData (line 313) | LogMessageData& operator=(const LogMessageData&) = delete;
      function ostream (line 2573) | ostream* CheckOpMessageBuilder::ForVar2() {
      function MakeCheckOpValueString (line 2584) | void MakeCheckOpValueString(std::ostream* os, const char& v) {
      function MakeCheckOpValueString (line 2593) | void MakeCheckOpValueString(std::ostream* os, const signed char& v) {
      function MakeCheckOpValueString (line 2602) | void MakeCheckOpValueString(std::ostream* os, const unsigned char& v) {
      function MakeCheckOpValueString (line 2611) | void MakeCheckOpValueString(std::ostream* os, const std::nullptr_t& ...
  function GLOG_NO_EXPORT (line 2488) | GLOG_NO_EXPORT
  function string (line 2542) | string StrError(int err) {
  type logging (line 2563) | namespace logging {
    type internal (line 286) | namespace internal {
      type LogMessageData (line 287) | struct LogMessageData {
        method LogMessageData (line 312) | LogMessageData(const LogMessageData&) = delete;
        method LogMessageData (line 313) | LogMessageData& operator=(const LogMessageData&) = delete;
      function ostream (line 2573) | ostream* CheckOpMessageBuilder::ForVar2() {
      function MakeCheckOpValueString (line 2584) | void MakeCheckOpValueString(std::ostream* os, const char& v) {
      function MakeCheckOpValueString (line 2593) | void MakeCheckOpValueString(std::ostream* os, const signed char& v) {
      function MakeCheckOpValueString (line 2602) | void MakeCheckOpValueString(std::ostream* os, const unsigned char& v) {
      function MakeCheckOpValueString (line 2611) | void MakeCheckOpValueString(std::ostream* os, const std::nullptr_t& ...
    type internal (line 2453) | namespace internal {
      type LogMessageData (line 287) | struct LogMessageData {
        method LogMessageData (line 312) | LogMessageData(const LogMessageData&) = delete;
        method LogMessageData (line 313) | LogMessageData& operator=(const LogMessageData&) = delete;
      function ostream (line 2573) | ostream* CheckOpMessageBuilder::ForVar2() {
      function MakeCheckOpValueString (line 2584) | void MakeCheckOpValueString(std::ostream* os, const char& v) {
      function MakeCheckOpValueString (line 2593) | void MakeCheckOpValueString(std::ostream* os, const signed char& v) {
      function MakeCheckOpValueString (line 2602) | void MakeCheckOpValueString(std::ostream* os, const unsigned char& v) {
      function MakeCheckOpValueString (line 2611) | void MakeCheckOpValueString(std::ostream* os, const std::nullptr_t& ...
    type internal (line 2564) | namespace internal {
      type LogMessageData (line 287) | struct LogMessageData {
        method LogMessageData (line 312) | LogMessageData(const LogMessageData&) = delete;
        method LogMessageData (line 313) | LogMessageData& operator=(const LogMessageData&) = delete;
      function ostream (line 2573) | ostream* CheckOpMessageBuilder::ForVar2() {
      function MakeCheckOpValueString (line 2584) | void MakeCheckOpValueString(std::ostream* os, const char& v) {
      function MakeCheckOpValueString (line 2593) | void MakeCheckOpValueString(std::ostream* os, const signed char& v) {
      function MakeCheckOpValueString (line 2602) | void MakeCheckOpValueString(std::ostream* os, const unsigned char& v) {
      function MakeCheckOpValueString (line 2611) | void MakeCheckOpValueString(std::ostream* os, const std::nullptr_t& ...
  function InitGoogleLogging (line 2618) | void InitGoogleLogging(const char* argv0) { InitGoogleLoggingUtilities(a...
  function InstallPrefixFormatter (line 2620) | void InstallPrefixFormatter(PrefixFormatterCallback callback, void* data) {
  function ShutdownGoogleLogging (line 2628) | void ShutdownGoogleLogging() {
  function EnableLogCleaner (line 2635) | void EnableLogCleaner(unsigned int overdue_days) {
  function EnableLogCleaner (line 2641) | void EnableLogCleaner(const std::chrono::minutes& overdue) {
  function DisableLogCleaner (line 2645) | void DisableLogCleaner() { log_cleaner.Disable(); }
  type void_impl (line 2652) | struct void_impl {
  type has_member_tm_gmtoff (line 2660) | struct has_member_tm_gmtoff : std::false_type {}
  type has_member_tm_gmtoff<T, void_t<decltype(&T::tm_gmtoff)>> (line 2663) | struct has_member_tm_gmtoff<T, void_t<decltype(&T::tm_gmtoff)>>
  function Breakdown (line 2667) | auto Breakdown(const std::chrono::system_clock::time_point& now)
  function Breakdown (line 2699) | auto Breakdown(const std::chrono::system_clock::time_point& now)

FILE: src/logging_unittest.cc
  type google (line 92) | namespace google {
    type base (line 93) | namespace base {
      type internal (line 94) | namespace internal {
    type glog_internal_namespace_ (line 1202) | inline namespace glog_internal_namespace_ {
  function BM_Check1 (line 126) | static void BM_Check1(int n) {
  function BM_Check3 (line 142) | static void BM_Check3(int n) {
  function BM_Check2 (line 156) | static void BM_Check2(int n) {
  function CheckFailure (line 173) | static void CheckFailure(int, int, const char* /* file */, int /* line */,
  function BM_logspeed (line 176) | static void BM_logspeed(int n) {
  function BM_vlog (line 183) | static void BM_vlog(int n) {
  function PrefixAttacher (line 194) | void PrefixAttacher(std::ostream& s, const LogMessage& m, void* data) {
  function main (line 211) | int main(int argc, char** argv) {
  function TestLogging (line 308) | void TestLogging(bool check_counts) {
  function NoAllocNewHook (line 359) | static void NoAllocNewHook() { LOG(FATAL) << "unexpected new"; }
  type NewHook (line 361) | struct NewHook {
    method NewHook (line 362) | NewHook() { g_new_hook = &NoAllocNewHook; }
  function TEST (line 370) | TEST(DeathNoAllocNewHook, logging) {
  function TestRawLogging (line 381) | void TestRawLogging() {
  function LogWithLevels (line 435) | void LogWithLevels(int v, int severity, bool err, bool alsoerr) {
  function TestLoggingLevels (line 520) | void TestLoggingLevels() {
  function TestVlogHelper (line 533) | int TestVlogHelper() {
  function TestVLogModule (line 540) | void TestVLogModule() {
  function TEST (line 551) | TEST(DeathRawCHECK, logging) {
  function TestLogString (line 558) | void TestLogString() {
  function TestLogToString (line 581) | void TestLogToString() {
  class TestLogSinkImpl (line 603) | class TestLogSinkImpl : public LogSink {
    method send (line 606) | void send(LogSeverity severity, const char* /* full_filename */,
  function TestLogSink (line 615) | void TestLogSink() {
  function TestCHECK (line 662) | void TestCHECK() {
  function TestDCHECK (line 688) | void TestDCHECK() {
  function TestSTREQ (line 708) | void TestSTREQ() {
  function TEST (line 721) | TEST(DeathSTREQ, logging) {
  function TEST (line 731) | TEST(CheckNOTNULL, Simple) {
  function TEST (line 742) | TEST(DeathCheckNN, Simple) {
  function GetFiles (line 747) | static void GetFiles(const string& pattern, vector<string>* files) {
  function DeleteFiles (line 781) | static void DeleteFiles(const string& pattern) {
  function CheckFile (line 790) | static void CheckFile(const string& name, const string& expected_string,
  function TestMaxLogSizeWhenNoTimestamp (line 811) | static void TestMaxLogSizeWhenNoTimestamp() {
  function TestBasename (line 852) | static void TestBasename() {
  function TestBasenameAppendWhenNoTimestamp (line 868) | static void TestBasenameAppendWhenNoTimestamp() {
  function TestTwoProcessesWrite (line 897) | static void TestTwoProcessesWrite() {
  function TestSymlink (line 938) | static void TestSymlink() {
  function TestExtension (line 957) | static void TestExtension() {
  type MyLogger (line 979) | struct MyLogger : public base::Logger {
    method MyLogger (line 982) | explicit MyLogger(bool* set_on_destruction)
    method Write (line 987) | void Write(bool /* should_flush */,
    method Flush (line 993) | void Flush() override {}
    method uint32 (line 995) | uint32 LogSize() override { return static_cast<uint32>(data.length()); }
  function TestWrapper (line 1001) | static void TestWrapper() {
  function TestErrno (line 1017) | static void TestErrno() {
  function TestOneTruncate (line 1025) | static void TestOneTruncate(const char* path, uint64 limit, uint64 keep,
  function TestTruncate (line 1069) | static void TestTruncate() {
  type RecordDeletionLogger (line 1111) | struct RecordDeletionLogger : public base::Logger {
    method RecordDeletionLogger (line 1112) | RecordDeletionLogger(bool* set_on_destruction, base::Logger* wrapped_l...
    method Write (line 1118) | void Write(bool force_flush,
    method Flush (line 1123) | void Flush() override { wrapped_logger_->Flush(); }
    method uint32 (line 1124) | uint32 LogSize() override { return wrapped_logger_->LogSize(); }
  function TestCustomLoggerDeletionOnShutdown (line 1131) | static void TestCustomLoggerDeletionOnShutdown() {
  type LogTimes (line 1142) | namespace LogTimes {
  type LogTimeRecorder (line 1157) | struct LogTimeRecorder {
    method LogTimeRecorder (line 1158) | LogTimeRecorder() = default;
  function int64 (line 1170) | int64 elapsedTime_ns(const std::chrono::steady_clock::time_point& begin,
  function TestLogPeriodically (line 1176) | static void TestLogPeriodically() {
  type google (line 1201) | namespace google {
    type base (line 93) | namespace base {
      type internal (line 94) | namespace internal {
    type glog_internal_namespace_ (line 1202) | inline namespace glog_internal_namespace_ {
  function WrapSafeFNMatch (line 1209) | static bool WrapSafeFNMatch(string pattern, string str) {
  function TEST (line 1216) | TEST(SafeFNMatch, logging) {
  class TestLogSinkWriter (line 1244) | class TestLogSinkWriter {
    method TestLogSinkWriter (line 1246) | TestLogSinkWriter() : t_{&TestLogSinkWriter::Run, this} {}
    method Buffer (line 1249) | void Buffer(const string& message) {
    method Wait (line 1258) | void Wait() {
    method Stop (line 1272) | void Stop() {
    method Join (line 1277) | void Join() { t_.join(); }
    method NoWork (line 1283) | bool NoWork() { return messages_.empty(); }
    method HaveWork (line 1284) | bool HaveWork() { return !messages_.empty() || should_exit_; }
    method Run (line 1287) | void Run() {
  class TestWaitingLogSink (line 1334) | class TestWaitingLogSink : public LogSink {
    method TestWaitingLogSink (line 1336) | TestWaitingLogSink() {
    method send (line 1348) | void send(LogSeverity severity, const char* /* full_filename */,
    method WaitTillSent (line 1361) | void WaitTillSent() override {
  function TestLogSinkWaitTillSent (line 1373) | static void TestLogSinkWaitTillSent() {
  function TEST (line 1395) | TEST(Strerror, logging) {
  function TEST (line 1431) | TEST(DVLog, Basic) {
  function TEST (line 1445) | TEST(DVLog, V0) {
  function TEST (line 1455) | TEST(LogAtLevel, Basic) {
  function TEST (line 1470) | TEST(TestExitOnDFatal, ToBeOrNotToBe) {
  function BacktraceAtHelper (line 1507) | static void BacktraceAtHelper() {
  function TEST (line 1515) | TEST(LogBacktraceAt, DoesNotBacktraceWhenDisabled) {
  function TEST (line 1526) | TEST(LogBacktraceAt, DoesBacktraceAtRightLineWhenEnabled) {
  type UserDefinedClass (line 1552) | struct UserDefinedClass {
  function ostream (line 1556) | inline ostream& operator<<(ostream& out, const UserDefinedClass&) {
  function TEST (line 1561) | TEST(UserDefinedClass, logging) {
  function TEST (line 1572) | TEST(LogMsgTime, gmtoff) {
  function TEST (line 1588) | TEST(EmailLogging, ValidAddress) {
  function TEST (line 1596) | TEST(EmailLogging, MultipleAddresses) {
  function TEST (line 1604) | TEST(EmailLogging, InvalidAddress) {
  function TEST (line 1611) | TEST(EmailLogging, MaliciousAddress) {
  function TEST (line 1619) | TEST(Logging, FatalThrow) {

FILE: src/mock-log.h
  function namespace (line 46) | namespace google {

FILE: src/mock-log_unittest.cc
  function TEST (line 54) | TEST(ScopedMockLogTest, InterceptsLog) {
  function LogBranch (line 69) | void LogBranch() { LOG(INFO) << "Logging a branch..."; }
  function LogTree (line 71) | void LogTree() { LOG(INFO) << "Logging the whole tree..."; }
  function LogForest (line 73) | void LogForest() {
  function TEST (line 82) | TEST(ScopedMockLogTest, LogDuringIntercept) {
  function main (line 97) | int main(int argc, char** argv) {

FILE: src/package_config_unittest/working_config/glog_package_config.cc
  function main (line 3) | int main(int /*argc*/, char** argv) { google::InitGoogleLogging(argv[0]); }

FILE: src/raw_logging.cc
  type google (line 72) | namespace google {
    function DoRawLog (line 93) | static bool DoRawLog(char** buf, size_t* size, const char* format, ...) {
    function VADoRawLog (line 105) | inline static bool VADoRawLog(char** buf, size_t* size, const char* fo...
    class StaticStringBuf (line 128) | class StaticStringBuf : public std::streambuf {
      method StaticStringBuf (line 130) | StaticStringBuf() {
    function RawLog__ (line 147) | void RawLog__(LogSeverity severity, const char* file, int line,

FILE: src/signalhandler.cc
  type google (line 63) | namespace google {
    class MinimalFormatter (line 104) | class MinimalFormatter {
      method MinimalFormatter (line 106) | MinimalFormatter(char* buffer, size_t size)
      method num_bytes_written (line 110) | std::size_t num_bytes_written() const {
      method AppendString (line 115) | void AppendString(const char* str) {
      method AppendUint64 (line 126) | void AppendUint64(uint64 number, unsigned radix) {
      method AppendHexWithPadding (line 144) | void AppendHexWithPadding(uint64 number, int width) {
    function WriteToStderr (line 164) | void WriteToStderr(const char* data, size_t size) {
    function DumpTimeInfo (line 175) | void DumpTimeInfo() {
    function DumpSignalInfo (line 192) | void DumpSignalInfo(int signal_number, siginfo_t* siginfo) {
    function DumpStackFrameInfo (line 244) | void DumpStackFrameInfo(const char* prefix, void* pc) {
    function InvokeDefaultSignalHandler (line 274) | void InvokeDefaultSignalHandler(int signal_number) {
    function FailureSignalHandler (line 355) | void FailureSignalHandler(int signal_number, siginfo_t* signal_info,
    function IsFailureSignalHandlerInstalled (line 369) | bool IsFailureSignalHandlerInstalled() {
    function InstallFailureSignalHandler (line 385) | void InstallFailureSignalHandler() {
    function InstallFailureWriter (line 406) | void InstallFailureWriter(void (*writer)(const char* data, size_t size...

FILE: src/signalhandler_unittest.cc
  function DieInThread (line 60) | static void DieInThread(int* a) {
  function WriteToStdout (line 69) | static void WriteToStdout(const char* data, size_t size) {
  function main (line 75) | int main(int argc, char** argv) {

FILE: src/stacktrace.h
  function namespace (line 69) | namespace google {

FILE: src/stacktrace_generic-inl.h
  function namespace (line 40) | namespace google {

FILE: src/stacktrace_libunwind-inl.h
  function namespace (line 43) | namespace google {

FILE: src/stacktrace_powerpc-inl.h
  function namespace (line 43) | namespace google {

FILE: src/stacktrace_unittest.cc
  type AddressRange (line 53) | struct AddressRange {
  function CheckRetAddrIsInFunction (line 111) | static void CheckRetAddrIsInFunction(void* ret_addr,
  function main (line 230) | int main(int, char** argv) {
  function main (line 241) | int main() {

FILE: src/stacktrace_unwind-inl.h
  function namespace (line 38) | namespace google {

FILE: src/stacktrace_windows-inl.h
  function namespace (line 39) | namespace google {

FILE: src/stacktrace_x86-inl.h
  function namespace (line 45) | namespace google {

FILE: src/stl_logging_unittest.cc
  type user_hash (line 45) | struct user_hash {
  function TestSTLLogging (line 49) | static void TestSTLLogging() {
  function main (line 110) | int main(int, char**) {

FILE: src/striplog_unittest.cc
  function CheckNoReturn (line 49) | int CheckNoReturn(bool b) {
  type A (line 59) | struct A {}
  function handle_abort (line 63) | void handle_abort(int /*code*/) { std::exit(EXIT_FAILURE); }
  function main (line 66) | int main(int, char* argv[]) {

FILE: src/symbolize.cc
  type google (line 73) | namespace google {
    type glog_internal_namespace_ (line 74) | inline namespace glog_internal_namespace_ {
      function ATTRIBUTE_NOINLINE (line 85) | ATTRIBUTE_NOINLINE
      function InstallSymbolizeCallback (line 100) | void InstallSymbolizeCallback(SymbolizeCallback callback) {
      function InstallSymbolizeOpenObjectFileCallback (line 104) | void InstallSymbolizeOpenObjectFileCallback(
      function ATTRIBUTE_NOINLINE (line 830) | static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(
      class SymInitializer (line 859) | class SymInitializer final {
        method SymInitializer (line 863) | SymInitializer() : process(GetCurrentProcess()), ready(false) {
        method SymInitializer (line 879) | SymInitializer(const SymInitializer&) = delete;
        method SymInitializer (line 880) | SymInitializer& operator=(const SymInitializer&) = delete;
        method SymInitializer (line 881) | SymInitializer(SymInitializer&&) = delete;
        method SymInitializer (line 882) | SymInitializer& operator=(SymInitializer&&) = delete;
      function ATTRIBUTE_NOINLINE (line 887) | static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void* pc, char* ...
      function Symbolize (line 956) | bool Symbolize(void* pc, char* out, size_t out_size, SymbolizeOption...
    type glog_internal_namespace_ (line 828) | inline namespace glog_internal_namespace_ {
      function ATTRIBUTE_NOINLINE (line 85) | ATTRIBUTE_NOINLINE
      function InstallSymbolizeCallback (line 100) | void InstallSymbolizeCallback(SymbolizeCallback callback) {
      function InstallSymbolizeOpenObjectFileCallback (line 104) | void InstallSymbolizeOpenObjectFileCallback(
      function ATTRIBUTE_NOINLINE (line 830) | static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(
      class SymInitializer (line 859) | class SymInitializer final {
        method SymInitializer (line 863) | SymInitializer() : process(GetCurrentProcess()), ready(false) {
        method SymInitializer (line 879) | SymInitializer(const SymInitializer&) = delete;
        method SymInitializer (line 880) | SymInitializer& operator=(const SymInitializer&) = delete;
        method SymInitializer (line 881) | SymInitializer(SymInitializer&&) = delete;
        method SymInitializer (line 882) | SymInitializer& operator=(SymInitializer&&) = delete;
      function ATTRIBUTE_NOINLINE (line 887) | static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void* pc, char* ...
      function Symbolize (line 956) | bool Symbolize(void* pc, char* out, size_t out_size, SymbolizeOption...
    type glog_internal_namespace_ (line 855) | inline namespace glog_internal_namespace_ {
      function ATTRIBUTE_NOINLINE (line 85) | ATTRIBUTE_NOINLINE
      function InstallSymbolizeCallback (line 100) | void InstallSymbolizeCallback(SymbolizeCallback callback) {
      function InstallSymbolizeOpenObjectFileCallback (line 104) | void InstallSymbolizeOpenObjectFileCallback(
      function ATTRIBUTE_NOINLINE (line 830) | static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(
      class SymInitializer (line 859) | class SymInitializer final {
        method SymInitializer (line 863) | SymInitializer() : process(GetCurrentProcess()), ready(false) {
        method SymInitializer (line 879) | SymInitializer(const SymInitializer&) = delete;
        method SymInitializer (line 880) | SymInitializer& operator=(const SymInitializer&) = delete;
        method SymInitializer (line 881) | SymInitializer(SymInitializer&&) = delete;
        method SymInitializer (line 882) | SymInitializer& operator=(SymInitializer&&) = delete;
      function ATTRIBUTE_NOINLINE (line 887) | static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void* pc, char* ...
      function Symbolize (line 956) | bool Symbolize(void* pc, char* out, size_t out_size, SymbolizeOption...
    type glog_internal_namespace_ (line 954) | inline namespace glog_internal_namespace_ {
      function ATTRIBUTE_NOINLINE (line 85) | ATTRIBUTE_NOINLINE
      function InstallSymbolizeCallback (line 100) | void InstallSymbolizeCallback(SymbolizeCallback callback) {
      function InstallSymbolizeOpenObjectFileCallback (line 104) | void InstallSymbolizeOpenObjectFileCallback(
      function ATTRIBUTE_NOINLINE (line 830) | static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(
      class SymInitializer (line 859) | class SymInitializer final {
        method SymInitializer (line 863) | SymInitializer() : process(GetCurrentProcess()), ready(false) {
        method SymInitializer (line 879) | SymInitializer(const SymInitializer&) = delete;
        method SymInitializer (line 880) | SymInitializer& operator=(const SymInitializer&) = delete;
        method SymInitializer (line 881) | SymInitializer(SymInitializer&&) = delete;
        method SymInitializer (line 882) | SymInitializer& operator=(SymInitializer&&) = delete;
      function ATTRIBUTE_NOINLINE (line 887) | static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void* pc, char* ...
      function Symbolize (line 956) | bool Symbolize(void* pc, char* out, size_t out_size, SymbolizeOption...
  type glog_internal_namespace_ (line 135) | inline namespace glog_internal_namespace_ {
    function FailureRetry (line 142) | auto FailureRetry(Functor run, int error = EINTR) noexcept(noexcept(ru...
    function ReadFromOffset (line 157) | static ssize_t ReadFromOffset(const int fd, void* buf, const size_t co...
    function ReadFromOffsetExact (line 185) | static bool ReadFromOffsetExact(const int fd, void* buf, const size_t ...
    function FileGetElfType (line 192) | static int FileGetElfType(const int fd) {
    function ATTRIBUTE_NOINLINE (line 208) | static ATTRIBUTE_NOINLINE bool GetSectionHeaderByType(const int fd,
    function GetSectionHeaderByName (line 243) | bool GetSectionHeaderByName(int fd, const char* name, size_t name_len,
    function ATTRIBUTE_NOINLINE (line 294) | static ATTRIBUTE_NOINLINE bool FindSymbol(uint64_t pc, const int fd, c...
    function GetSymbolFromObjectFile (line 349) | static bool GetSymbolFromObjectFile(const int fd, uint64_t pc, char* out,
    class LineReader (line 395) | class LineReader {
      method LineReader (line 397) | explicit LineReader(int fd, char* buf, size_t buf_len, size_t offset)
      method ReadLine (line 411) | bool ReadLine(const char** bol, const char** eol) {
      method LineReader (line 458) | LineReader(const LineReader&) = delete;
      method BufferIsEmpty (line 466) | bool BufferIsEmpty() { return buf_ == eod_; }
      method HasCompleteLine (line 468) | bool HasCompleteLine() {
    function ATTRIBUTE_NOINLINE (line 509) | static ATTRIBUTE_NOINLINE FileDescriptor
    function SafeAppendString (line 713) | static void SafeAppendString(const char* source, char* dest, size_t de...
    function SafeAppendHexNumber (line 726) | static void SafeAppendHexNumber(uint64_t value, char* dest, size_t des...
    function ATTRIBUTE_NOINLINE (line 740) | static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(
  type google (line 827) | namespace google {
    type glog_internal_namespace_ (line 74) | inline namespace glog_internal_namespace_ {
      function ATTRIBUTE_NOINLINE (line 85) | ATTRIBUTE_NOINLINE
      function InstallSymbolizeCallback (line 100) | void InstallSymbolizeCallback(SymbolizeCallback callback) {
      function InstallSymbolizeOpenObjectFileCallback (line 104) | void InstallSymbolizeOpenObjectFileCallback(
      function ATTRIBUTE_NOINLINE (line 830) | static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(
      class SymInitializer (line 859) | class SymInitializer final {
        method SymInitializer (line 863) | SymInitializer() : process(GetCurrentProcess()), ready(false) {
        method SymInitializer (line 879) | SymInitializer(const SymInitializer&) = delete;
        method SymInitializer (line 880) | SymInitializer& operator=(const SymInitializer&) = delete;
        method SymInitializer (line 881) | SymInitializer(SymInitializer&&) = delete;
        method SymInitializer (line 882) | SymInitializer& operator=(SymInitializer&&) = delete;
      function ATTRIBUTE_NOINLINE (line 887) | static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void* pc, char* ...
      function Symbolize (line 956) | bool Symbolize(void* pc, char* out, size_t out_size, SymbolizeOption...
    type glog_internal_namespace_ (line 828) | inline namespace glog_internal_namespace_ {
      function ATTRIBUTE_NOINLINE (line 85) | ATTRIBUTE_NOINLINE
      function InstallSymbolizeCallback (line 100) | void InstallSymbolizeCallback(SymbolizeCallback callback) {
      function InstallSymbolizeOpenObjectFileCallback (line 104) | void InstallSymbolizeOpenObjectFileCallback(
      function ATTRIBUTE_NOINLINE (line 830) | static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(
      class SymInitializer (line 859) | class SymInitializer final {
        method SymInitializer (line 863) | SymInitializer() : process(GetCurrentProcess()), ready(false) {
        method SymInitializer (line 879) | SymInitializer(const SymInitializer&) = delete;
        method SymInitializer (line 880) | SymInitializer& operator=(const SymInitializer&) = delete;
        method SymInitializer (line 881) | SymInitializer(SymInitializer&&) = delete;
        method SymInitializer (line 882) | SymInitializer& operator=(SymInitializer&&) = delete;
      function ATTRIBUTE_NOINLINE (line 887) | static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void* pc, char* ...
      function Symbolize (line 956) | bool Symbolize(void* pc, char* out, size_t out_size, SymbolizeOption...
    type glog_internal_namespace_ (line 855) | inline namespace glog_internal_namespace_ {
      function ATTRIBUTE_NOINLINE (line 85) | ATTRIBUTE_NOINLINE
      function InstallSymbolizeCallback (line 100) | void InstallSymbolizeCallback(SymbolizeCallback callback) {
      function InstallSymbolizeOpenObjectFileCallback (line 104) | void InstallSymbolizeOpenObjectFileCallback(
      function ATTRIBUTE_NOINLINE (line 830) | static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(
      class SymInitializer (line 859) | class SymInitializer final {
        method SymInitializer (line 863) | SymInitializer() : process(GetCurrentProcess()), ready(false) {
        method SymInitializer (line 879) | SymInitializer(const SymInitializer&) = delete;
        method SymInitializer (line 880) | SymInitializer& operator=(const SymInitializer&) = delete;
        method SymInitializer (line 881) | SymInitializer(SymInitializer&&) = delete;
        method SymInitializer (line 882) | SymInitializer& operator=(SymInitializer&&) = delete;
      function ATTRIBUTE_NOINLINE (line 887) | static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void* pc, char* ...
      function Symbolize (line 956) | bool Symbolize(void* pc, char* out, size_t out_size, SymbolizeOption...
    type glog_internal_namespace_ (line 954) | inline namespace glog_internal_namespace_ {
      function ATTRIBUTE_NOINLINE (line 85) | ATTRIBUTE_NOINLINE
      function InstallSymbolizeCallback (line 100) | void InstallSymbolizeCallback(SymbolizeCallback callback) {
      function InstallSymbolizeOpenObjectFileCallback (line 104) | void InstallSymbolizeOpenObjectFileCallback(
      function ATTRIBUTE_NOINLINE (line 830) | static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(
      class SymInitializer (line 859) | class SymInitializer final {
        method SymInitializer (line 863) | SymInitializer() : process(GetCurrentProcess()), ready(false) {
        method SymInitializer (line 879) | SymInitializer(const SymInitializer&) = delete;
        method SymInitializer (line 880) | SymInitializer& operator=(const SymInitializer&) = delete;
        method SymInitializer (line 881) | SymInitializer(SymInitializer&&) = delete;
        method SymInitializer (line 882) | SymInitializer& operator=(SymInitializer&&) = delete;
      function ATTRIBUTE_NOINLINE (line 887) | static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void* pc, char* ...
      function Symbolize (line 956) | bool Symbolize(void* pc, char* out, size_t out_size, SymbolizeOption...
  type google (line 854) | namespace google {
    type glog_internal_namespace_ (line 74) | inline namespace glog_internal_namespace_ {
      function ATTRIBUTE_NOINLINE (line 85) | ATTRIBUTE_NOINLINE
      function InstallSymbolizeCallback (line 100) | void InstallSymbolizeCallback(SymbolizeCallback callback) {
      function InstallSymbolizeOpenObjectFileCallback (line 104) | void InstallSymbolizeOpenObjectFileCallback(
      function ATTRIBUTE_NOINLINE (line 830) | static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(
      class SymInitializer (line 859) | class SymInitializer final {
        method SymInitializer (line 863) | SymInitializer() : process(GetCurrentProcess()), ready(false) {
        method SymInitializer (line 879) | SymInitializer(const SymInitializer&) = delete;
        method SymInitializer (line 880) | SymInitializer& operator=(const SymInitializer&) = delete;
        method SymInitializer (line 881) | SymInitializer(SymInitializer&&) = delete;
        method SymInitializer (line 882) | SymInitializer& operator=(SymInitializer&&) = delete;
      function ATTRIBUTE_NOINLINE (line 887) | static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void* pc, char* ...
      function Symbolize (line 956) | bool Symbolize(void* pc, char* out, size_t out_size, SymbolizeOption...
    type glog_internal_namespace_ (line 828) | inline namespace glog_internal_namespace_ {
      function ATTRIBUTE_NOINLINE (line 85) | ATTRIBUTE_NOINLINE
      function InstallSymbolizeCallback (line 100) | void InstallSymbolizeCallback(SymbolizeCallback callback) {
      function InstallSymbolizeOpenObjectFileCallback (line 104) | void InstallSymbolizeOpenObjectFileCallback(
      function ATTRIBUTE_NOINLINE (line 830) | static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(
      class SymInitializer (line 859) | class SymInitializer final {
        method SymInitializer (line 863) | SymInitializer() : process(GetCurrentProcess()), ready(false) {
        method SymInitializer (line 879) | SymInitializer(const SymInitializer&) = delete;
        method SymInitializer (line 880) | SymInitializer& operator=(const SymInitializer&) = delete;
        method SymInitializer (line 881) | SymInitializer(SymInitializer&&) = delete;
        method SymInitializer (line 882) | SymInitializer& operator=(SymInitializer&&) = delete;
      function ATTRIBUTE_NOINLINE (line 887) | static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void* pc, char* ...
      function Symbolize (line 956) | bool Symbolize(void* pc, char* out, size_t out_size, SymbolizeOption...
    type glog_internal_namespace_ (line 855) | inline namespace glog_internal_namespace_ {
      function ATTRIBUTE_NOINLINE (line 85) | ATTRIBUTE_NOINLINE
      function InstallSymbolizeCallback (line 100) | void InstallSymbolizeCallback(SymbolizeCallback callback) {
      function InstallSymbolizeOpenObjectFileCallback (line 104) | void InstallSymbolizeOpenObjectFileCallback(
      function ATTRIBUTE_NOINLINE (line 830) | static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(
      class SymInitializer (line 859) | class SymInitializer final {
        method SymInitializer (line 863) | SymInitializer() : process(GetCurrentProcess()), ready(false) {
        method SymInitializer (line 879) | SymInitializer(const SymInitializer&) = delete;
        method SymInitializer (line 880) | SymInitializer& operator=(const SymInitializer&) = delete;
        method SymInitializer (line 881) | SymInitializer(SymInitializer&&) = delete;
        method SymInitializer (line 882) | SymInitializer& operator=(SymInitializer&&) = delete;
      function ATTRIBUTE_NOINLINE (line 887) | static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void* pc, char* ...
      function Symbolize (line 956) | bool Symbolize(void* pc, char* out, size_t out_size, SymbolizeOption...
    type glog_internal_namespace_ (line 954) | inline namespace glog_internal_namespace_ {
      function ATTRIBUTE_NOINLINE (line 85) | ATTRIBUTE_NOINLINE
      function InstallSymbolizeCallback (line 100) | void InstallSymbolizeCallback(SymbolizeCallback callback) {
      function InstallSymbolizeOpenObjectFileCallback (line 104) | void InstallSymbolizeOpenObjectFileCallback(
      function ATTRIBUTE_NOINLINE (line 830) | static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(
      class SymInitializer (line 859) | class SymInitializer final {
        method SymInitializer (line 863) | SymInitializer() : process(GetCurrentProcess()), ready(false) {
        method SymInitializer (line 879) | SymInitializer(const SymInitializer&) = delete;
        method SymInitializer (line 880) | SymInitializer& operator=(const SymInitializer&) = delete;
        method SymInitializer (line 881) | SymInitializer(SymInitializer&&) = delete;
        method SymInitializer (line 882) | SymInitializer& operator=(SymInitializer&&) = delete;
      function ATTRIBUTE_NOINLINE (line 887) | static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void* pc, char* ...
      function Symbolize (line 956) | bool Symbolize(void* pc, char* out, size_t out_size, SymbolizeOption...
  type google (line 953) | namespace google {
    type glog_internal_namespace_ (line 74) | inline namespace glog_internal_namespace_ {
      function ATTRIBUTE_NOINLINE (line 85) | ATTRIBUTE_NOINLINE
      function InstallSymbolizeCallback (line 100) | void InstallSymbolizeCallback(SymbolizeCallback callback) {
      function InstallSymbolizeOpenObjectFileCallback (line 104) | void InstallSymbolizeOpenObjectFileCallback(
      function ATTRIBUTE_NOINLINE (line 830) | static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(
      class SymInitializer (line 859) | class SymInitializer final {
        method SymInitializer (line 863) | SymInitializer() : process(GetCurrentProcess()), ready(false) {
        method SymInitializer (line 879) | SymInitializer(const SymInitializer&) = delete;
        method SymInitializer (line 880) | SymInitializer& operator=(const SymInitializer&) = delete;
        method SymInitializer (line 881) | SymInitializer(SymInitializer&&) = delete;
        method SymInitializer (line 882) | SymInitializer& operator=(SymInitializer&&) = delete;
      function ATTRIBUTE_NOINLINE (line 887) | static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void* pc, char* ...
      function Symbolize (line 956) | bool Symbolize(void* pc, char* out, size_t out_size, SymbolizeOption...
    type glog_internal_namespace_ (line 828) | inline namespace glog_internal_namespace_ {
      function ATTRIBUTE_NOINLINE (line 85) | ATTRIBUTE_NOINLINE
      function InstallSymbolizeCallback (line 100) | void InstallSymbolizeCallback(SymbolizeCallback callback) {
      function InstallSymbolizeOpenObjectFileCallback (line 104) | void InstallSymbolizeOpenObjectFileCallback(
      function ATTRIBUTE_NOINLINE (line 830) | static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(
      class SymInitializer (line 859) | class SymInitializer final {
        method SymInitializer (line 863) | SymInitializer() : process(GetCurrentProcess()), ready(false) {
        method SymInitializer (line 879) | SymInitializer(const SymInitializer&) = delete;
        method SymInitializer (line 880) | SymInitializer& operator=(const SymInitializer&) = delete;
        method SymInitializer (line 881) | SymInitializer(SymInitializer&&) = delete;
        method SymInitializer (line 882) | SymInitializer& operator=(SymInitializer&&) = delete;
      function ATTRIBUTE_NOINLINE (line 887) | static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void* pc, char* ...
      function Symbolize (line 956) | bool Symbolize(void* pc, char* out, size_t out_size, SymbolizeOption...
    type glog_internal_namespace_ (line 855) | inline namespace glog_internal_namespace_ {
      function ATTRIBUTE_NOINLINE (line 85) | ATTRIBUTE_NOINLINE
      function InstallSymbolizeCallback (line 100) | void InstallSymbolizeCallback(SymbolizeCallback callback) {
      function InstallSymbolizeOpenObjectFileCallback (line 104) | void InstallSymbolizeOpenObjectFileCallback(
      function ATTRIBUTE_NOINLINE (line 830) | static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(
      class SymInitializer (line 859) | class SymInitializer final {
        method SymInitializer (line 863) | SymInitializer() : process(GetCurrentProcess()), ready(false) {
        method SymInitializer (line 879) | SymInitializer(const SymInitializer&) = delete;
        method SymInitializer (line 880) | SymInitializer& operator=(const SymInitializer&) = delete;
        method SymInitializer (line 881) | SymInitializer(SymInitializer&&) = delete;
        method SymInitializer (line 882) | SymInitializer& operator=(SymInitializer&&) = delete;
      function ATTRIBUTE_NOINLINE (line 887) | static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void* pc, char* ...
      function Symbolize (line 956) | bool Symbolize(void* pc, char* out, size_t out_size, SymbolizeOption...
    type glog_internal_namespace_ (line 954) | inline namespace glog_internal_namespace_ {
      function ATTRIBUTE_NOINLINE (line 85) | ATTRIBUTE_NOINLINE
      function InstallSymbolizeCallback (line 100) | void InstallSymbolizeCallback(SymbolizeCallback callback) {
      function InstallSymbolizeOpenObjectFileCallback (line 104) | void InstallSymbolizeOpenObjectFileCallback(
      function ATTRIBUTE_NOINLINE (line 830) | static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(
      class SymInitializer (line 859) | class SymInitializer final {
        method SymInitializer (line 863) | SymInitializer() : process(GetCurrentProcess()), ready(false) {
        method SymInitializer (line 879) | SymInitializer(const SymInitializer&) = delete;
        method SymInitializer (line 880) | SymInitializer& operator=(const SymInitializer&) = delete;
        method SymInitializer (line 881) | SymInitializer(SymInitializer&&) = delete;
        method SymInitializer (line 882) | SymInitializer& operator=(SymInitializer&&) = delete;
      function ATTRIBUTE_NOINLINE (line 887) | static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void* pc, char* ...
      function Symbolize (line 956) | bool Symbolize(void* pc, char* out, size_t out_size, SymbolizeOption...

FILE: src/symbolize.h
  function namespace (line 118) | namespace google {
  function namespace (line 132) | namespace google {
  function namespace (line 171) | namespace google {

FILE: src/symbolize_unittest.cc
  function nonstatic_func (line 98) | void nonstatic_func() {
  function static_func (line 105) | static void static_func() {
  function TEST (line 113) | TEST(Symbolize, Symbolize) {
  type Foo (line 134) | struct Foo {
  function TEST (line 148) | TEST(Symbolize, SymbolizeWithDemangling) {
  function EmptySignalHandler (line 181) | static void EmptySignalHandler(int /*signo*/) {}
  function SymbolizeSignalHandler (line 183) | static void SymbolizeSignalHandler(int /*signo*/) {
  function ATTRIBUTE_NOINLINE (line 198) | static ATTRIBUTE_NOINLINE bool StackGrowsDown(int* x) {
  function GetStackConsumption (line 202) | static int GetStackConsumption(const char* alt_stack) {
  type sigaction (line 244) | struct sigaction
  type sigaction (line 245) | struct sigaction
  type sigaction (line 246) | struct sigaction
  function TEST (line 301) | TEST(Symbolize, SymbolizeStackConsumption) {
  function TEST (line 327) | TEST(Symbolize, SymbolizeWithDemanglingStackConsumption) {
  type Foo (line 417) | struct Foo {
  function TEST (line 428) | TEST(Symbolize, SymbolizeWithDemangling) {
  function TestWithReturnAddress (line 437) | __declspec(noinline) void TestWithReturnAddress() {
  function main (line 456) | int main(int argc, char** argv) {

FILE: src/utilities.cc
  type google (line 76) | namespace google {
    function IsGoogleLoggingInitialized (line 80) | bool IsGoogleLoggingInitialized() {
    type glog_internal_namespace_ (line 84) | inline namespace glog_internal_namespace_ {
      function AlsoErrorWrite (line 88) | void AlsoErrorWrite(LogSeverity severity, const char* tag,
      function int32 (line 247) | int32 GetMainThreadPid() { return g_main_thread_pid; }
      function PidHasChanged (line 249) | bool PidHasChanged() {
      function string (line 259) | const string& MyUserName() { return g_my_user_name; }
      function MyUserNameInitializer (line 260) | static void MyUserNameInitializer() {
      function SetCrashReason (line 294) | void SetCrashReason(const logging::internal::CrashReason* r) {
      function InitGoogleLoggingUtilities (line 299) | void InitGoogleLoggingUtilities(const char* argv0) {
      function ShutdownGoogleLoggingUtilities (line 309) | void ShutdownGoogleLoggingUtilities() {
    type glog_internal_namespace_ (line 219) | inline namespace glog_internal_namespace_ {
      function AlsoErrorWrite (line 88) | void AlsoErrorWrite(LogSeverity severity, const char* tag,
      function int32 (line 247) | int32 GetMainThreadPid() { return g_main_thread_pid; }
      function PidHasChanged (line 249) | bool PidHasChanged() {
      function string (line 259) | const string& MyUserName() { return g_my_user_name; }
      function MyUserNameInitializer (line 260) | static void MyUserNameInitializer() {
      function SetCrashReason (line 294) | void SetCrashReason(const logging::internal::CrashReason* r) {
      function InitGoogleLoggingUtilities (line 299) | void InitGoogleLoggingUtilities(const char* argv0) {
      function ShutdownGoogleLoggingUtilities (line 309) | void ShutdownGoogleLoggingUtilities() {
    function GetStackTrace (line 322) | std::string GetStackTrace() {
  function DebugWriteToStderr (line 130) | static void DebugWriteToStderr(const char* data, void*) {
  function DebugWriteToString (line 139) | static void DebugWriteToString(const char* data, void* arg) {
  function DumpPCAndSymbol (line 145) | static void DumpPCAndSymbol(DebugWriter* writerfn, void* arg, void* pc,
  function DumpPC (line 162) | static void DumpPC(DebugWriter* writerfn, void* arg, void* pc,
  function DumpStackTrace (line 171) | static void DumpStackTrace(int skip_count, DebugWriter* writerfn, void* ...
  function DumpStackTraceAndExit (line 189) | __attribute__((noreturn))
  type google (line 217) | namespace google {
    function IsGoogleLoggingInitialized (line 80) | bool IsGoogleLoggingInitialized() {
    type glog_internal_namespace_ (line 84) | inline namespace glog_internal_namespace_ {
      function AlsoErrorWrite (line 88) | void AlsoErrorWrite(LogSeverity severity, const char* tag,
      function int32 (line 247) | int32 GetMainThreadPid() { return g_main_thread_pid; }
      function PidHasChanged (line 249) | bool PidHasChanged() {
      function string (line 259) | const string& MyUserName() { return g_my_user_name; }
      function MyUserNameInitializer (line 260) | static void MyUserNameInitializer() {
      function SetCrashReason (line 294) | void SetCrashReason(const logging::internal::CrashReason* r) {
      function InitGoogleLoggingUtilities (line 299) | void InitGoogleLoggingUtilities(const char* argv0) {
      function ShutdownGoogleLoggingUtilities (line 309) | void ShutdownGoogleLoggingUtilities() {
    type glog_internal_namespace_ (line 219) | inline namespace glog_internal_namespace_ {
      function AlsoErrorWrite (line 88) | void AlsoErrorWrite(LogSeverity severity, const char* tag,
      function int32 (line 247) | int32 GetMainThreadPid() { return g_main_thread_pid; }
      function PidHasChanged (line 249) | bool PidHasChanged() {
      function string (line 259) | const string& MyUserName() { return g_my_user_name; }
      function MyUserNameInitializer (line 260) | static void MyUserNameInitializer() {
      function SetCrashReason (line 294) | void SetCrashReason(const logging::internal::CrashReason* r) {
      function InitGoogleLoggingUtilities (line 299) | void InitGoogleLoggingUtilities(const char* argv0) {
      function ShutdownGoogleLoggingUtilities (line 309) | void ShutdownGoogleLoggingUtilities() {
    function GetStackTrace (line 322) | std::string GetStackTrace() {

FILE: src/utilities.h
  function namespace (line 110) | namespace google {
  function noexcept (line 258) | nullptr_t) noexcept {
  function noexcept (line 266) | nullptr_t) noexcept {
  function FILE (line 279) | struct std::default_delete<std::FILE> {

FILE: src/utilities_unittest.cc
  function TEST (line 43) | TEST(utilities, InitGoogleLoggingDeathTest) {
  function main (line 47) | int main(int argc, char** argv) {

FILE: src/vlog_is_on.cc
  type google (line 49) | namespace google {
    type glog_internal_namespace_ (line 51) | inline namespace glog_internal_namespace_ {
      function GLOG_NO_EXPORT (line 57) | GLOG_NO_EXPORT bool SafeFNMatch_(const char* pattern, size_t patt_len,
    type VModuleInfo (line 96) | struct VModuleInfo {
    function VLOG2Initializer (line 115) | static void VLOG2Initializer() {
    function SetVLOGLevel (line 150) | int SetVLOGLevel(const char* module_pattern, int log_level) {
    function InitVLOG3__ (line 203) | bool InitVLOG3__(SiteFlag* site_flag, int32* level_default, const char...

FILE: src/windows/dirent.h
  type _wdirent (line 220) | struct _wdirent {
  type _WDIR (line 240) | struct _WDIR {
  type dirent (line 258) | struct dirent {
  type DIR (line 278) | struct DIR {
  type dirent (line 287) | struct dirent
  type _wdirent (line 288) | struct _wdirent
  type dirent (line 290) | struct dirent
  type dirent (line 290) | struct dirent
  type _wdirent (line 291) | struct _wdirent
  type _wdirent (line 292) | struct _wdirent
  type dirent (line 300) | struct dirent
  type dirent (line 301) | struct dirent
  type dirent (line 302) | struct dirent
  type dirent (line 303) | struct dirent
  type dirent (line 305) | struct dirent
  type dirent (line 305) | struct dirent
  type dirent (line 307) | struct dirent
  type dirent (line 307) | struct dirent
  function _WDIR (line 336) | static _WDIR* _wopendir(const wchar_t* dirname) {
  type _wdirent (line 434) | struct _wdirent
  type _wdirent (line 435) | struct _wdirent
  function _wreaddir_r (line 453) | static int _wreaddir_r(_WDIR* dirp, struct _wdirent* entry,
  function _wclosedir (line 509) | static int _wclosedir(_WDIR* dirp) {
  function _wrewinddir (line 536) | static void _wrewinddir(_WDIR* dirp) {
  function WIN32_FIND_DATAW (line 549) | static WIN32_FIND_DATAW* dirent_first(_WDIR* dirp) {
  function WIN32_FIND_DATAW (line 593) | static WIN32_FIND_DATAW* dirent_next(_WDIR* dirp) {
  type DIR (line 634) | struct DIR
  type dirent (line 670) | struct dirent
  type dirent (line 671) | struct dirent
  function readdir_r (line 689) | static int readdir_r(DIR* dirp, struct dirent* entry, struct dirent** re...
  function closedir (line 768) | static int closedir(DIR* dirp) {
  function rewinddir (line 789) | static void rewinddir(DIR* dirp) {
  function scandir (line 797) | static int scandir(const char* dirname, struct dirent*** namelist,
  function alphasort (line 924) | static int alphasort(const struct dirent** a, const struct dirent** b) {
  function versionsort (line 929) | static int versionsort(const struct dirent** a, const struct dirent** b) {
  function dirent_mbstowcs_s (line 935) | static int dirent_mbstowcs_s(size_t* pReturnValue, wchar_t* wcstr,
  function dirent_wcstombs_s (line 979) | static int dirent_wcstombs_s(size_t* pReturnValue, char* mbstr,
  function dirent_set_errno (line 1023) | static void dirent_set_errno(int error) {

FILE: src/windows/port.cc
  type google (line 45) | namespace google {
    type glog_internal_namespace_ (line 46) | inline namespace glog_internal_namespace_ {
      type tm (line 49) | struct tm
      type tm (line 55) | struct tm

FILE: src/windows/port.h
  function namespace (line 122) | namespace google {
Condensed preview — 121 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (789K chars).
[
  {
    "path": ".bazelci/presubmit.yml",
    "chars": 1616,
    "preview": "---\ntasks:\n  ubuntu1804:\n    name: \"Ubuntu 22.04\"\n    platform: ubuntu2204\n    build_flags:\n    - \"--features=layering_c"
  },
  {
    "path": ".clang-format",
    "chars": 4530,
    "preview": "---\nLanguage:        Cpp\n# BasedOnStyle:  Google\nAccessModifierOffset: -1\nAlignAfterOpenBracket: Align\nAlignConsecutiveM"
  },
  {
    "path": ".clang-tidy",
    "chars": 2721,
    "preview": "---\nChecks:          'clang-diagnostic-*,clang-analyzer-*,google-*,modernize-*,-modernize-use-trailing-return-type,reada"
  },
  {
    "path": ".gitattributes",
    "chars": 26,
    "preview": "*.h linguist-language=C++\n"
  },
  {
    "path": ".github/dependabot.yml",
    "chars": 216,
    "preview": "# Set update schedule for GitHub Actions\n\nversion: 2\nupdates:\n\n  - package-ecosystem: \"github-actions\"\n    directory: \"/"
  },
  {
    "path": ".github/workflows/android.yml",
    "chars": 2089,
    "preview": "name: Android\n\non: [push, pull_request]\n\njobs:\n  build-android:\n    name: NDK-C++${{matrix.std}}-${{matrix.abi}}-${{matr"
  },
  {
    "path": ".github/workflows/cifuzz.yml",
    "chars": 692,
    "preview": "name: CIFuzz\non: [pull_request]\njobs:\n  Fuzzing:\n    runs-on: ubuntu-latest\n    steps:\n    - name: Build Fuzzers\n      i"
  },
  {
    "path": ".github/workflows/emscripten.yml",
    "chars": 1594,
    "preview": "name: Emscripten\n\non: [push, pull_request]\n\njobs:\n  build-linux:\n    defaults:\n      run:\n        shell: bash\n    name: "
  },
  {
    "path": ".github/workflows/linux.yml",
    "chars": 3966,
    "preview": "name: Linux\n\non: [push, pull_request]\n\njobs:\n  build-linux:\n    defaults:\n      run:\n        shell: bash\n    name: GCC-C"
  },
  {
    "path": ".github/workflows/macos.yml",
    "chars": 2155,
    "preview": "name: macOS\n\non: [push, pull_request]\n\njobs:\n  build-macos:\n    name: AppleClang-C++${{matrix.std}}-${{matrix.build_type"
  },
  {
    "path": ".github/workflows/windows.yml",
    "chars": 8332,
    "preview": "name: Windows\n\non: [push, pull_request]\n\njobs:\n  build-msvc:\n    name: ${{matrix.msvc}}-${{matrix.arch}}-C++${{matrix.st"
  },
  {
    "path": ".gitignore",
    "chars": 68,
    "preview": "*.orig\n/build*/\n/site/\nbazel-*\n# Bzlmod lockfile\n/MODULE.bazel.lock\n"
  },
  {
    "path": "AUTHORS",
    "chars": 1085,
    "preview": "# This is the official list of glog authors for copyright purposes.\n# This file is distinct from the CONTRIBUTORS files."
  },
  {
    "path": "BUILD.bazel",
    "chars": 600,
    "preview": "licenses([\"notice\"])\n\nexports_files([\"COPYING\"])\n\nload(\":bazel/glog.bzl\", \"glog_library\")\n\nglog_library()\n\n# platform() "
  },
  {
    "path": "CMakeLists.txt",
    "chars": 36655,
    "preview": "cmake_minimum_required (VERSION 3.22)\nproject (glog\n  VERSION 0.8.0\n  DESCRIPTION \"C++ implementation of the Google logg"
  },
  {
    "path": "CONTRIBUTORS",
    "chars": 2066,
    "preview": "# People who have agreed to one of the CLAs and can contribute patches.\n# The AUTHORS file lists the copyright holders; "
  },
  {
    "path": "ChangeLog",
    "chars": 3906,
    "preview": "2024-06-08  Google Inc. <opensource@google.com>\n\n\t* google-glog: version 0.7.1.\n\t* See git log for the details.\n\n2024-02"
  },
  {
    "path": "LICENSE.md",
    "chars": 1475,
    "preview": "Copyright © 2024, Google Inc.\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nm"
  },
  {
    "path": "MODULE.bazel",
    "chars": 512,
    "preview": "module(\n    name = \"glog\",\n    compatibility_level = 1,\n)\n\nbazel_dep(name = \"gflags\", version = \"2.2.2\")\nbazel_dep(name "
  },
  {
    "path": "README.rst",
    "chars": 747,
    "preview": "Google Logging Library\n======================\n\n**Deprecation notice**: This project is no longer maintained and will be "
  },
  {
    "path": "WORKSPACE.bazel",
    "chars": 40,
    "preview": "# WORKSPACE marker file needed by Bazel\n"
  },
  {
    "path": "bazel/example/BUILD.bazel",
    "chars": 141,
    "preview": "cc_test(\n    name = \"main\",\n    size = \"small\",\n    srcs = [\"main.cc\"],\n    deps = [\n        \"//:glog\",\n        \"@gflags"
  },
  {
    "path": "bazel/example/main.cc",
    "chars": 515,
    "preview": "#include <gflags/gflags.h>\n#include <glog/logging.h>\n#include <glog/stl_logging.h>\n\nint main(int argc, char* argv[]) {\n "
  },
  {
    "path": "bazel/glog.bzl",
    "chars": 9542,
    "preview": "# Implement a macro glog_library() that the BUILD.bazel file can load.\n\n# By default, glog is built with gflags support."
  },
  {
    "path": "cmake/DetermineGflagsNamespace.cmake",
    "chars": 2326,
    "preview": "macro(determine_gflags_namespace VARIABLE)\n  if (NOT DEFINED \"${VARIABLE}\")\n    if (CMAKE_REQUIRED_INCLUDES)\n      set ("
  },
  {
    "path": "cmake/FindUnwind.cmake",
    "chars": 2145,
    "preview": "# - Try to find libunwind\n# Once done this will define\n#\n#  Unwind_FOUND - system has libunwind\n#  unwind::unwind - cmak"
  },
  {
    "path": "cmake/GetCacheVariables.cmake",
    "chars": 2495,
    "preview": "cmake_policy (PUSH)\ncmake_policy (VERSION 3.16...3.27)\n\ninclude (CMakeParseArguments)\n\nfunction (get_cache_variables _CA"
  },
  {
    "path": "cmake/RunCleanerTest1.cmake",
    "chars": 804,
    "preview": "set (RUNS 3)\n\nforeach (iter RANGE 1 ${RUNS})\n  set (ENV{GOOGLE_LOG_DIR} ${TEST_DIR})\n  execute_process (COMMAND ${LOGCLE"
  },
  {
    "path": "cmake/RunCleanerTest2.cmake",
    "chars": 802,
    "preview": "set (RUNS 3)\n\nforeach (iter RANGE 1 ${RUNS})\n  execute_process (COMMAND ${LOGCLEANUP} -log_dir=${TEST_DIR}\n    RESULT_VA"
  },
  {
    "path": "cmake/RunCleanerTest3.cmake",
    "chars": 1058,
    "preview": "set (RUNS 3)\n\n# Create the subdirectory required by this unit test.\nfile (MAKE_DIRECTORY ${TEST_DIR}/${TEST_SUBDIR})\n\nfo"
  },
  {
    "path": "cmake/TestInitPackageConfig.cmake",
    "chars": 361,
    "preview": "# Create the build directory\nexecute_process (\n  COMMAND ${CMAKE_COMMAND} -E make_directory ${TEST_BINARY_DIR}\n  RESULT_"
  },
  {
    "path": "cmake/TestPackageConfig.cmake",
    "chars": 1131,
    "preview": "if (GENERATOR_TOOLSET)\n  list (APPEND _ADDITIONAL_ARGS -T ${GENERATOR_TOOLSET})\nendif (GENERATOR_TOOLSET)\n\nif (GENERATOR"
  },
  {
    "path": "codecov.yml",
    "chars": 227,
    "preview": "comment:\n  layout: \"diff, flags, files\"\n  behavior: default\n  require_changes: false\n  require_base: false\n  require_hea"
  },
  {
    "path": "docs/build.md",
    "chars": 2077,
    "preview": "# Building from Source\n\n## Bazel\n\nTo use glog within a project which uses the [Bazel](https://bazel.build/) build\ntool, "
  },
  {
    "path": "docs/contribute.md",
    "chars": 2495,
    "preview": "# How to Contribute\n\nWe'd love to accept your patches and contributions to this project.\nThere are a just a few small gu"
  },
  {
    "path": "docs/failures.md",
    "chars": 2527,
    "preview": "# Failure Signal Handler\n\n## Stacktrace as Default Failure Handler\n\nThe library provides a convenient signal handler tha"
  },
  {
    "path": "docs/flags.md",
    "chars": 3427,
    "preview": "# Adjusting Output\n\nSeveral flags influence glog's output behavior.\n\n## Using Command-line Parameters and Environment Va"
  },
  {
    "path": "docs/index.md",
    "chars": 982,
    "preview": "# Google Logging Library\n\nGoogle Logging (glog) is a C++14 library that implements application-level\nlogging. The librar"
  },
  {
    "path": "docs/license.md",
    "chars": 48,
    "preview": "# The 3-Clause BSD License\n\n--8<-- \"LICENSE.md\"\n"
  },
  {
    "path": "docs/log_cleaner.md",
    "chars": 648,
    "preview": "# Automatically Remove Old Logs\n\nTo enable the log cleaner:\n\n``` cpp\nusing namespace std::chrono_literals;\ngoogle::Enabl"
  },
  {
    "path": "docs/log_stripping.md",
    "chars": 703,
    "preview": "# Strip Logging Messages\n\nStrings used in log messages can increase the size of your binary and\npresent a privacy concer"
  },
  {
    "path": "docs/logging.md",
    "chars": 15462,
    "preview": "# Logging\n\nglog defines a series of macros that simplify many common logging tasks. You can\nlog messages by [severity le"
  },
  {
    "path": "docs/overrides/main.html",
    "chars": 196,
    "preview": "{% extends \"base.html\" %}\n\n{% block outdated %}\n  You're not viewing the latest version.\n  <a href=\"{{ '../' ~ base_url "
  },
  {
    "path": "docs/packages.md",
    "chars": 925,
    "preview": "# Installation using Package Managers\n\n## conan\n\nYou can download and install glog using the [conan](https://conan.io)\np"
  },
  {
    "path": "docs/requirements.txt",
    "chars": 171,
    "preview": "mike>=2.1.1\nmkdocs-git-committers-plugin-2>=2.3.0\nmkdocs-git-revision-date-localized-plugin>=1.2.6\nmkdocs-material-exten"
  },
  {
    "path": "docs/sinks.md",
    "chars": 3040,
    "preview": "# Custom Sinks\n\nUnder certain circumstances, it is useful to send the log output to a\ndestination other than a file, `st"
  },
  {
    "path": "docs/unwinder.md",
    "chars": 2579,
    "preview": "# Installation Notes for 64-bit Linux Systems\n\n!!! note\n    The description on this page is possibly not up-to-date.\n\nTh"
  },
  {
    "path": "docs/usage.md",
    "chars": 917,
    "preview": "# Using glog in a CMake Project\n\nAssuming that glog was previously [built using CMake](build.md#cmake) or\ninstalled usin"
  },
  {
    "path": "docs/windows.md",
    "chars": 1271,
    "preview": "# Notes for Windows Users\n\nglog defines the severity level `ERROR`, which is also defined by `windows.h`.\nYou can make g"
  },
  {
    "path": "examples/custom_sink.cc",
    "chars": 2683,
    "preview": "// Copyright (c) 2024, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "gcovr.cfg",
    "chars": 214,
    "preview": "exclude = src/.*_unittest\\.cc\nexclude = src/googletest\\.h\nexclude = src/mock-log\\.h\nexclude-directories = Tests/\nexclude"
  },
  {
    "path": "glog-config.cmake.in",
    "chars": 405,
    "preview": "if (CMAKE_VERSION VERSION_LESS @glog_CMake_VERSION@)\n  message (FATAL_ERROR \"CMake >= @glog_CMake_VERSION@ required\")\nen"
  },
  {
    "path": "glog-modules.cmake.in",
    "chars": 686,
    "preview": "cmake_policy (PUSH)\ncmake_policy (SET CMP0057 NEW)\n\nif (CMAKE_VERSION VERSION_LESS 3.3)\n  message (FATAL_ERROR \"glog-mod"
  },
  {
    "path": "libglog.pc.in",
    "chars": 276,
    "preview": "prefix=@prefix@\nexec_prefix=@exec_prefix@\nlibdir=@libdir@\nincludedir=@includedir@\n\nName: libglog\nDescription: Google Log"
  },
  {
    "path": "mkdocs.yml",
    "chars": 3270,
    "preview": "---\nsite_name: Google Logging Library\nsite_url: https://google.github.io/glog/\nrepo_url: https://github.com/google/glog\n"
  },
  {
    "path": "src/base/commandlineflags.h",
    "chars": 6369,
    "preview": "// Copyright (c) 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/base/googleinit.h",
    "chars": 2093,
    "preview": "// Copyright (c) 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/cleanup_immediately_unittest.cc",
    "chars": 3133,
    "preview": "// Copyright (c) 2024, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/cleanup_with_absolute_prefix_unittest.cc",
    "chars": 3285,
    "preview": "// Copyright (c) 2024, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/cleanup_with_relative_prefix_unittest.cc",
    "chars": 3225,
    "preview": "// Copyright (c) 2024, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/config.h.cmake.in",
    "chars": 3974,
    "preview": "#ifndef GLOG_CONFIG_H\n#define GLOG_CONFIG_H\n\n/* Define if you have the `dladdr' function */\n#cmakedefine HAVE_DLADDR\n\n/*"
  },
  {
    "path": "src/dcheck_unittest/CMakeLists.txt",
    "chars": 220,
    "preview": "cmake_minimum_required (VERSION 3.16)\nproject (glog_log_severity LANGUAGES CXX)\n\nfind_package (glog REQUIRED NO_MODULE)\n"
  },
  {
    "path": "src/dcheck_unittest/glog_dcheck.cc",
    "chars": 2154,
    "preview": "// Copyright (c) 2024, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/demangle.cc",
    "chars": 41160,
    "preview": "// Copyright (c) 2024, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/demangle.h",
    "chars": 3846,
    "preview": "// Copyright (c) 2006, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/demangle_unittest.cc",
    "chars": 5965,
    "preview": "// Copyright (c) 2006, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/demangle_unittest.sh",
    "chars": 3267,
    "preview": "#! /bin/sh\n#\n# Copyright (c) 2006, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and binary fo"
  },
  {
    "path": "src/demangle_unittest.txt",
    "chars": 5686,
    "preview": "# Test caces for demangle_unittest.  Each line consists of a\n# tab-separated pair of mangled and demangled symbol names."
  },
  {
    "path": "src/flags.cc",
    "chars": 6594,
    "preview": "// Copyright (c) 2024, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/fuzz_demangle.cc",
    "chars": 1038,
    "preview": "// Copyright 2023 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use th"
  },
  {
    "path": "src/glog/flags.h",
    "chars": 5990,
    "preview": "// Copyright (c) 2024, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/glog/log_severity.h",
    "chars": 4206,
    "preview": "// Copyright (c) 2024, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/glog/logging.h",
    "chars": 70555,
    "preview": "// Copyright (c) 2024, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/glog/platform.h",
    "chars": 2511,
    "preview": "// Copyright (c) 2024, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/glog/raw_logging.h",
    "chars": 7013,
    "preview": "// Copyright (c) 2024, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/glog/stl_logging.h",
    "chars": 6902,
    "preview": "// Copyright (c) 2023, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/glog/types.h",
    "chars": 2882,
    "preview": "\n// Copyright (c) 2024, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, wit"
  },
  {
    "path": "src/glog/vlog_is_on.h",
    "chars": 6115,
    "preview": "// Copyright (c) 2024, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/googletest.h",
    "chars": 21663,
    "preview": "// Copyright (c) 2024, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/includes_unittest/CMakeLists.txt",
    "chars": 669,
    "preview": "cmake_minimum_required (VERSION 3.16)\nproject (glog_includes LANGUAGES CXX)\n\nfind_package (glog REQUIRED NO_MODULE)\n\nadd"
  },
  {
    "path": "src/includes_unittest/glog_includes_logging.cc",
    "chars": 1734,
    "preview": "// Copyright (c) 2024, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/includes_unittest/glog_includes_raw_logging.cc",
    "chars": 1746,
    "preview": "// Copyright (c) 2024, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/includes_unittest/glog_includes_stl_logging.cc",
    "chars": 1635,
    "preview": "// Copyright (c) 2024, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/includes_unittest/glog_includes_vlog_is_on.cc",
    "chars": 1650,
    "preview": "// Copyright (c) 2024, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/log_severity_unittest/CMakeLists.txt",
    "chars": 419,
    "preview": "cmake_minimum_required (VERSION 3.16)\nproject (glog_log_severity LANGUAGES CXX)\n\nfind_package (glog REQUIRED NO_MODULE)\n"
  },
  {
    "path": "src/log_severity_unittest/glog_log_severity_constants.cc",
    "chars": 1782,
    "preview": "// Copyright (c) 2024, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/log_severity_unittest/glog_log_severity_conversion.cc",
    "chars": 1955,
    "preview": "// Copyright (c) 2024, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/logging.cc",
    "chars": 94128,
    "preview": "// Copyright (c) 2024, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/logging_striplog_test.sh",
    "chars": 2746,
    "preview": "#! /bin/sh\n#\n# Copyright (c) 2023, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and binary fo"
  },
  {
    "path": "src/logging_unittest.cc",
    "chars": 50095,
    "preview": "// Copyright (c) 2024, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/logging_unittest.err",
    "chars": 22559,
    "preview": "IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Test: v=0 stderrthreshold=2 logtostderr=0 alsologtostderr=0\nIYE"
  },
  {
    "path": "src/logging_unittest.out",
    "chars": 10890,
    "preview": "IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1\nIYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 0\nI"
  },
  {
    "path": "src/mock-log.h",
    "chars": 6453,
    "preview": "// Copyright (c) 2007, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/mock-log_unittest.cc",
    "chars": 3659,
    "preview": "// Copyright (c) 2022, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/package_config_unittest/working_config/CMakeLists.txt",
    "chars": 247,
    "preview": "cmake_minimum_required (VERSION 3.16)\nproject (glog_package_config LANGUAGES CXX)\n\nfind_package (glog REQUIRED NO_MODULE"
  },
  {
    "path": "src/package_config_unittest/working_config/glog_package_config.cc",
    "chars": 103,
    "preview": "#include \"glog/logging.h\"\n\nint main(int /*argc*/, char** argv) { google::InitGoogleLogging(argv[0]); }\n"
  },
  {
    "path": "src/raw_logging.cc",
    "chars": 7259,
    "preview": "// Copyright (c) 2024, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/signalhandler.cc",
    "chars": 13328,
    "preview": "// Copyright (c) 2024, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/signalhandler_unittest.cc",
    "chars": 3593,
    "preview": "// Copyright (c) 2024, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/signalhandler_unittest.sh",
    "chars": 4278,
    "preview": "#! /bin/sh\n#\n# Copyright (c) 2008, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and binary fo"
  },
  {
    "path": "src/stacktrace.cc",
    "chars": 1781,
    "preview": "// Copyright (c) 2024, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/stacktrace.h",
    "chars": 3367,
    "preview": "// Copyright (c) 2024, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/stacktrace_generic-inl.h",
    "chars": 2510,
    "preview": "// Copyright (c) 2000 - 2007, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary form"
  },
  {
    "path": "src/stacktrace_libunwind-inl.h",
    "chars": 3292,
    "preview": "// Copyright (c) 2005 - 2007, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary form"
  },
  {
    "path": "src/stacktrace_powerpc-inl.h",
    "chars": 5798,
    "preview": "// Copyright (c) 2007, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/stacktrace_unittest.cc",
    "chars": 9121,
    "preview": "// Copyright (c) 2004, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/stacktrace_unwind-inl.h",
    "chars": 3376,
    "preview": "// Copyright (c) 2023, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/stacktrace_windows-inl.h",
    "chars": 2303,
    "preview": "// Copyright (c) 2000 - 2007, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary form"
  },
  {
    "path": "src/stacktrace_x86-inl.h",
    "chars": 6066,
    "preview": "// Copyright (c) 2000 - 2007, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary form"
  },
  {
    "path": "src/stl_logging_unittest.cc",
    "chars": 3422,
    "preview": "// Copyright (c) 2003, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/striplog_unittest.cc",
    "chars": 2966,
    "preview": "// Copyright (c) 2023, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/symbolize.cc",
    "chars": 33730,
    "preview": "// Copyright (c) 2024, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/symbolize.h",
    "chars": 7977,
    "preview": "// Copyright (c) 2024, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/symbolize_unittest.cc",
    "chars": 15790,
    "preview": "// Copyright (c) 2024, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/utilities.cc",
    "chars": 9501,
    "preview": "// Copyright (c) 2024, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/utilities.h",
    "chars": 8607,
    "preview": "// Copyright (c) 2024, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/utilities_unittest.cc",
    "chars": 2014,
    "preview": "// Copyright (c) 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/vlog_is_on.cc",
    "chars": 9739,
    "preview": "// Copyright (c) 2024, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/windows/dirent.h",
    "chars": 24837,
    "preview": "/*\n * Dirent interface for Microsoft Visual Studio\n *\n * Copyright (C) 1998-2019 Toni Ronkko\n * This file is part of dir"
  },
  {
    "path": "src/windows/port.cc",
    "chars": 2296,
    "preview": "/* Copyright (c) 2023, Google Inc.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with"
  },
  {
    "path": "src/windows/port.h",
    "chars": 5083,
    "preview": "/* Copyright (c) 2023, Google Inc.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with"
  }
]

About this extraction

This page contains the full source code of the google/glog GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 121 files (738.3 KB), approximately 194.9k tokens, and a symbol index with 506 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!