142ee14279065352a4b9a3e8028d02c567e847d05Elliott Hughes/*
242ee14279065352a4b9a3e8028d02c567e847d05Elliott Hughes * Copyright (C) 2011 The Android Open Source Project
342ee14279065352a4b9a3e8028d02c567e847d05Elliott Hughes *
442ee14279065352a4b9a3e8028d02c567e847d05Elliott Hughes * Licensed under the Apache License, Version 2.0 (the "License");
542ee14279065352a4b9a3e8028d02c567e847d05Elliott Hughes * you may not use this file except in compliance with the License.
642ee14279065352a4b9a3e8028d02c567e847d05Elliott Hughes * You may obtain a copy of the License at
742ee14279065352a4b9a3e8028d02c567e847d05Elliott Hughes *
842ee14279065352a4b9a3e8028d02c567e847d05Elliott Hughes *      http://www.apache.org/licenses/LICENSE-2.0
942ee14279065352a4b9a3e8028d02c567e847d05Elliott Hughes *
1042ee14279065352a4b9a3e8028d02c567e847d05Elliott Hughes * Unless required by applicable law or agreed to in writing, software
1142ee14279065352a4b9a3e8028d02c567e847d05Elliott Hughes * distributed under the License is distributed on an "AS IS" BASIS,
1242ee14279065352a4b9a3e8028d02c567e847d05Elliott Hughes * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1342ee14279065352a4b9a3e8028d02c567e847d05Elliott Hughes * See the License for the specific language governing permissions and
1442ee14279065352a4b9a3e8028d02c567e847d05Elliott Hughes * limitations under the License.
1542ee14279065352a4b9a3e8028d02c567e847d05Elliott Hughes */
16eb4f614f2eb53b92ebd416fa418f550861655887Elliott Hughes
17e222ee0b794f941af4fb1b32fb8224e32942ea7bElliott Hughes#include "logging.h"
18e222ee0b794f941af4fb1b32fb8224e32942ea7bElliott Hughes
1990a3369d3b6238f1a4c9b19ca68978dab1c39bc4Elliott Hughes#include <sys/types.h>
2090a3369d3b6238f1a4c9b19ca68978dab1c39bc4Elliott Hughes#include <unistd.h>
21eb4f614f2eb53b92ebd416fa418f550861655887Elliott Hughes
22eb4f614f2eb53b92ebd416fa418f550861655887Elliott Hughes#include <cstdio>
23eb4f614f2eb53b92ebd416fa418f550861655887Elliott Hughes#include <cstring>
24eb4f614f2eb53b92ebd416fa418f550861655887Elliott Hughes#include <iostream>
2590a3369d3b6238f1a4c9b19ca68978dab1c39bc4Elliott Hughes
26e222ee0b794f941af4fb1b32fb8224e32942ea7bElliott Hughes#include "base/stringprintf.h"
2742ee14279065352a4b9a3e8028d02c567e847d05Elliott Hughes#include "utils.h"
28eb4f614f2eb53b92ebd416fa418f550861655887Elliott Hughes
29f5a7a476e7ea63e094ff0f011dccc170607e6f6bElliott Hughesnamespace art {
30f5a7a476e7ea63e094ff0f011dccc170607e6f6bElliott Hughes
31af1b89281fd1f86efeb791b61f5a3f2031c70312Brian Carlstromvoid LogMessage::LogLine(const LogMessageData& data, const char* message) {
32af1b89281fd1f86efeb791b61f5a3f2031c70312Brian Carlstrom  char severity = "VDIWEFF"[data.severity];
330d39c12238499ca9ccc34d1532c443335e7c1044Elliott Hughes  fprintf(stderr, "%s %c %5d %5d %s:%d] %s\n",
340d39c12238499ca9ccc34d1532c443335e7c1044Elliott Hughes          ProgramInvocationShortName(), severity, getpid(), ::art::GetTid(),
35af1b89281fd1f86efeb791b61f5a3f2031c70312Brian Carlstrom          data.file, data.line_number, message);
36eb4f614f2eb53b92ebd416fa418f550861655887Elliott Hughes}
37f5a7a476e7ea63e094ff0f011dccc170607e6f6bElliott Hughes
38f5a7a476e7ea63e094ff0f011dccc170607e6f6bElliott Hughes}  // namespace art
39