패키지, 저장소 및 앱 카테고리 검색

roggle 표지
패키지 상세v0.4.2+1

roggle

dart용으로 간단하고 색다르며 확장하기 쉬운 로거입니다. logger에 영감을 받아 logger에 의존합니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
254
좋아요
33
Pub 점수
130

패키지 설치

flutter pub add roggle

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Roggle은 인기 있는 로거 라이브러리에서 영감을 받은 간단하고 색다르며 확장하기 쉬운 Dart용 로깅 패키지입니다. Android, iOS, Web, macOS, Windows, Linux 등 다양한 플랫폼에서 로그를 출력할 수 있도록 깔끔하고 직관적인 API를 제공합니다. 생동감 있는 색상 코드와 사용자 정의 가능한 포맷팅으로 복잡성 없이 디버그 가시성을 향상시킵니다. 가벼운 설계로 개발 및 프로덕션 환경 모두에 적합하며, 최소한의 설정으로 시각적으로 두드러진 로깅 경험을 원하는 개발자에게 이상적입니다. 이 패키지는 pub.dev를 통해 Flutter 프로젝트에 원활하게 통합될 수 있습니다.

사용 사례

  • 응용 프로그램 흐름 디버깅
  • 런타임 동작 모니터링
  • 개발 중 로그 가독성 향상
  • 크로스 플랫폼 로깅
  • 기존 프로젝트에 빠르게 통합
  • 로그 레벨의 시각적 구분

주요 기능

  • 색상 있는 콘솔 출력
  • 간단하고 직관적인 API
  • 확장 가능한 설계
  • 다중 플랫폼 지원
  • 최소 구성
  • 로그 레벨 필터링

적합한 대상

  • 시각적 로그 명확성을 원하는 개발자
  • 경량 로깅이 필요한 Flutter 앱
  • 개발자 경험을 우선시하는 팀
  • 읽기 쉬운 디버그 출력이 필요한 프로젝트
  • 명확한 피드백을 통한 빠른 프로토타이핑
  • 중요한 종속성 없이 간단한 로깅

고려 사항

  • 고용량 생산 로깅에 적합하지 않습니다
  • 기능이 풍부한 로거에 비해 고급 기능이 제한적
  • 색 출력은 비터미널 환경에서는 유용하지 않을 수 있습니다
  • 핵심 기능을 위해 외부 로거에 의존합니다
  • 사용자 지정 포맷터를 위해 추가 구성이 필요할 수 있습니다
  • 개발 또는 저처리량 시나리오에서 가장 잘 사용됩니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

logo

Roggle

Test codecov MIT

Simple, colorful and easy to expand logger for dart.
Inspired by the logger and dependent to the logger.

Getting Started

Just create an instance of Roggle and start logging:

import 'package:roggle/roggle.dart';

final logger = Roggle();

logger.d('Roggle is working!');

Instead of a string message, you can also pass other objects like List, Map, Set or Function.

Output

Android Studio

Documentation

Roggle's API is almost the same as the logger. See the logger for basic usage.

Difference from the logger

  • Printer defaults to SinglePrettyPrinter class.
  • Not try-catch at LogOutput class, because we want to stop the process.
  • Added some getters in Roggle class.
  • Changed the log interface dynamic to Object?.

Options

If you use the SinglePrettyPrinter, there are more options:

final logger = Roggle(
  printer: SinglePrettyPrinter(
    loggerName: '[APP]', // Print a logger name for each log message
    colors: true, // Colorful log messages
    printCaller: true, // Print a caller for each log message
    printLocation: true, // Print a location of caller for each log message
    printFunctionName: true, // Print a function name of caller for each log message
    printEmojis: true, // Print an emoji for each log message
    printLabels: true, // Print a level string for each log message
    printTime: true, // Print a timestamp for each log message
    stackTraceLevel:
        Level.error, // The current logging level to display stack trace
    stackTraceMethodCount: 10, // Number of stack trace methods to display
    stackTracePrefix: '>>> ', // Replace stack trace prefix
    levelColors: {}, // Replace level colors map
    levelEmojis: {}, // Replace level emojis map
    levelLabels: {}, // Replace level labels map
    timeFormatter: (now) => DateFormat('yyyy/MM/dd HH:mm:ss.SSS')
        .format(now), // Replace time formatter
  ),
);

SinglePrettyPrinter

You can use the Roggle.crashlytics() to send errors and logs using the FirebaseCrashlytics API in release mode.

final logger = Roggle.crashlytics(
  printer: CrashlyticsPrinter(
    errorLevel: Level.error, // Logs above this level will call onError
    onError: (event) {
      // Send an error to Firebase Crashlytics as follows
      FirebaseCrashlytics.instance.recordError(
        event.exception,
        event.stack,
        fatal: true,
      );
    },
    onLog: (event) {
      // Send logs to Firebase Crashlytics as follows
      FirebaseCrashlytics.instance.log(event.message);
    },
    loggerName: '[APP]',
    printCaller: true, // Print a caller for each log message
    printLocation: true, // Print a location of caller for each log message
    printFunctionName: true, // Print a function name of caller for each log message
    printEmojis: true, // Print an emoji for each log message
    printLabels: true, // Print a level string for each log message
    levelEmojis: {}, // Replace level emojis map
    levelLabels: {}, // Replace level labels map
  ),
);

Tips

If you want to stop the process at the same time as the error log, do the following.

import 'package:roggle/roggle.dart';

final logger = Roggle(
  output: AssertionOutput(),
);

class AssertionOutput extends ConsoleOutput {
  @override
  void output(OutputEvent event) {
    super.output(event);
    if (event.level.index >= Level.error.index) {
      throw AssertionError('Stopped by logger.');
    }
  }
}

License

MIT License

Copyright (c) 2022 Keyber Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

카테고리

의존성

의존성 목록 3 개

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.