blob: 0399128d65cffbc9b50f025edd08da3fa5adc6f9 [file] [log] [blame]
Elliott Hughes42ee1422011-09-06 12:33:32 -07001/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
Elliott Hugheseb4f6142011-07-15 17:43:51 -070016
Elliott Hughese222ee02012-12-13 14:41:43 -080017#include "logging.h"
18
Elliott Hughes90a33692011-08-30 13:27:07 -070019#include <sys/types.h>
20#include <unistd.h>
Elliott Hugheseb4f6142011-07-15 17:43:51 -070021
22#include <cstdio>
23#include <cstring>
Elliott Hugheseb4f6142011-07-15 17:43:51 -070024#include <iostream>
Elliott Hughes90a33692011-08-30 13:27:07 -070025
Elliott Hughese222ee02012-12-13 14:41:43 -080026#include "base/stringprintf.h"
Elliott Hughes42ee1422011-09-06 12:33:32 -070027#include "utils.h"
Elliott Hugheseb4f6142011-07-15 17:43:51 -070028
Elliott Hughesf5a7a472011-10-07 14:31:02 -070029namespace art {
30
Brian Carlstromaf1b8922012-11-27 15:19:57 -080031void LogMessage::LogLine(const LogMessageData& data, const char* message) {
32 char severity = "VDIWEFF"[data.severity];
Elliott Hughes0d39c122012-06-06 16:41:17 -070033 fprintf(stderr, "%s %c %5d %5d %s:%d] %s\n",
34 ProgramInvocationShortName(), severity, getpid(), ::art::GetTid(),
Brian Carlstromaf1b8922012-11-27 15:19:57 -080035 data.file, data.line_number, message);
Elliott Hugheseb4f6142011-07-15 17:43:51 -070036}
Elliott Hughesf5a7a472011-10-07 14:31:02 -070037
38} // namespace art